Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Question
Message
De
11/03/1999 07:23:23
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00196263
Message ID:
00196287
Vues:
42
>>>Hello All,
>>>I need to select some records from a table that are not present in another table, I've heard you can do this with one of the outer joins but am unsure as to how
>>
>>Try something like,
>>
>>SELECT .* ;
>> FROM Tab1 ;
>> WHERE KeyField NOT IN ;
>> (SELECT DISTINCT KeyField FROM Tab2)
>
>Mark,
>thanks, I thought these new inner and outer joins dispensed with sub queries
>
Indeed they have - but not when you don't want the keys that are present in both the tables
a SELECT tab1.* fro Tab1 left join tab2 on tab1.KeyField=Tab2.KeyField
will give you the results of the query above plus the mathcing keys (in the above query you would just get all the fields from tab1)
This is useful if you need some data from tables 2 which is not always there

Arnon
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform