Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Question
Message
From
11/03/1999 07:23:23
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00196263
Message ID:
00196287
Views:
33
>>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform