>>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only