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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 SELECT

Author  Topic 

Shastryv
Posting Yak Master

145 Posts

Posted - 2004-09-13 : 14:44:45
Have 4 table and I need to find out the list of the rows that are present in Table A and doesn’t exist in either table B or Table C or table D.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-09-13 : 18:34:13
Assuming all 4 tables have identical column names:
SELECT A.field1, A.field2, ....
FROM TableA A LEFT JOIN TableB B ON (A.field1 = B.field1 AND A.field2 = B.field2 ...)
LEFT JOIN TableC C ON (A.field1 = C.field1 AND A.field2 = C.field2 ...)
LEFT JOIN TableD D ON (A.field1 = D.field1 AND A.field2 = D.field2 ...)
WHERE B.field1 IS NULL AND C.field1 IS NULL AND D.field1 IS NULL


Go to Top of Page
   

- Advertisement -