A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL Intersect



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2004, 03:46 PM
Allan
external usenet poster
 
Posts: n/a
Default SQL Intersect

I am going through a "teach yourself SQL in 21 days" and doing the examples
in Access. They are using Personal Oracle in the book, so I am noting the
differences in implementations between Jet SQL (Access) and Personal Oracle.

My Question:
HOW DO WE ACCOMPLISH THE "INTERSECT" OPERATOR in MS Jet SQL?

============================
Allan


  #2  
Old June 1st, 2004, 05:08 PM
Michel Walsh
external usenet poster
 
Posts: n/a
Default SQL Intersect

Hi,

I don't know the implementation of Intersect, in ORACLE, but in general, an
intersection can be represented with an INNER JOIN (if there is no
duplicated values) or with an IN criteria.



SELECT Table1.*
FROM Table1 INNER JOIN table2
ON table1.pk=table2.pk


would return records in table1 having their primary key in table2. You can
also try:

SELECT *
FROM Table1
WHERE pk IN(SELECT pk FROM table2)



The first formulation won't work with involved fields in table2 that can
have duplicated values. If table2.pk has two records with the same value,
and the value is also present in table1.pk, then the result would present
the record from table1, but twice.



Hoping it may help,
Vanderghast, Access MVP



"Allan" wrote in message
news:6F0vc.8125$RK3.4827@clgrps13...
I am going through a "teach yourself SQL in 21 days" and doing the

examples
in Access. They are using Personal Oracle in the book, so I am noting the
differences in implementations between Jet SQL (Access) and Personal

Oracle.

My Question:
HOW DO WE ACCOMPLISH THE "INTERSECT" OPERATOR in MS Jet SQL?

============================
Allan




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.