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
 Transact-SQL (2000)
 SELECT

Author  Topic 

Shastryv
Posting Yak Master

145 Posts

Posted - 2004-09-13 : 15:06:15
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.

DustinMichaels
Constraint Violating Yak Guru

464 Posts

Posted - 2004-09-13 : 15:12:42
select ...
from ...
where not exists (select * from tableB where tableAColumn = tableBColumn)
AND not exists (select * from tableC where tableAColumn = tableCColumn)
AND not exists (select * from tableD where tableAColumn = tableDColumn)

Theres probably a faster way to do it with left outer joins.
Go to Top of Page

hgorijal
Constraint Violating Yak Guru

277 Posts

Posted - 2004-09-14 : 02:15:17
select A.*
from A
left outer join B on A.column = B.column
left outer join C on A.column = C.column
left outer join D on A.column = D.column
where B.column is null
and C.column is null
and D.column is null


Hemanth Gorijala
BI Architect / DBA
Go to Top of Page
   

- Advertisement -