Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL - in table a, but not table b
Message
 
 
À
03/03/2009 04:51:38
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01385157
Message ID:
01385185
Vues:
59
>>
>>select * from TableA where PK not in (select FK from TableB)
>>
>>See interesting discussion at
>>http://blog.sqlauthority.com/2008/04/22/sql-server-better-performance-left-join-or-not-in/
>
>Noami,
>
>You forgot the third possiblity
>
>SELECT * FROM TableA T1 WHERE NOT EXISTS(SELECT 1 FROM TableB WHERE FK = T1.PK)
>
>The EXISTS() clause is a very important and often underestimated insturment in resolving these types of queries. Above all it is a more natural translation of the asked question: Give me everything from table A which does not have records in table B.
>
>
>
>
>Walter,

Hi Walter,

I know about it, but it was discussed in the referenced blog in the comments.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform