Excluding all items from another table from the database results...in SQL [modified]
-
Could somebody kindly point me to an article about performing a join that excludes the results from another table? I believe that it is something resembling WHERE tblFirstTable.Key...NOT IN tblSecondTable.Key or something.
modified on Tuesday, January 29, 2008 5:19:13 PM
-
Could somebody kindly point me to an article about performing a join that excludes the results from another table? I believe that it is something resembling WHERE tblFirstTable.Key...NOT IN tblSecondTable.Key or something.
modified on Tuesday, January 29, 2008 5:19:13 PM
I have written a small query to illustrate how to do this. As you were polite in asking for an article and not the code (to be honest it's quicker for me to write the code than find an article). This example shows how to find all the animals in the zoo table that are not on the feeding table - I guess some animals are going to go hungry. :(
select distinct z.animal from zoo z left join feeding f on z.animal= f.animal and f.animal is null
Regards GuyYou always pass failure on the way to success.