Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find where not in 2 tables

Author  Topic 

PeteLeHoq
Starting Member

37 Posts

Posted - 2014-02-14 : 10:49:08
This script gets me results from one table. Checking that x does not exist in table A compared to table B.

SELECT A.x
FROM A LEFT OUTER JOIN B ON A.x = B.x
WHERE B.x IS NULL

But I also need to check x does not have another value set in a third table(C) with column(y) having a value of 3 for example.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-02-14 : 14:10:34
Add a join for the 3rd table.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -