Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intersection
Message
 
 
To
27/05/2003 15:22:34
David Brunelle
Université de Sherbrooke
Sherbrooke, Quebec, Canada
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Miscellaneous
Thread ID:
00793228
Message ID:
00793231
Views:
21
>I have a collegue who wants to do a SQL select statement in ACCESS where he wants to have all the records from one table that doesn't have any matches from another table. (In logic, we refer that as the difference sometime : (A / B) = All A which are not in B) He said that with an Oracle server, it would be select... from A intersect B, but I can say if it's true or not. Does anybody know the correct syntax for a SQL server 2000 database?
SELECT * FROM table1 
  WHERE NOT EXISTS (SELECT * FROM table2 WHERE table2.keyfield = table2.keyfield)
-- OR
SELECT * FROM table1 
  WHERE keyfield NOT IN (SELECT keyfield FROM table2)
My guess is that execution plan would be the same for both queries.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform