Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Intersection
Message
 
 
À
27/05/2003 15:22:34
David Brunelle
Université de Sherbrooke
Sherbrooke, Québec, Canada
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00793228
Message ID:
00793231
Vues:
20
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform