Does anyone know how I would go about using a exist/ not exist statement instead of a minus set operator?
thanks
1 Replies - 3197 Views - Last Post: 05 June 2012 - 04:36 AM
#1
replace a minus set operator with exist/not exist statement?
Posted 15 May 2012 - 04:30 AM
Replies To: replace a minus set operator with exist/not exist statement?
#2
Re: replace a minus set operator with exist/not exist statement?
Posted 05 June 2012 - 04:36 AM
Let's assume you have 2 tables, A and B with common column called ID.
If I have undertood your question correctly you want to use the EXIST/NOT EXISTS to find all the records in table A which do not exists in table B.
A set difference query will be
Same query using Not Exist would be
If I have undertood your question correctly you want to use the EXIST/NOT EXISTS to find all the records in table A which do not exists in table B.
A set difference query will be
Select A.* from A left join B on A.ID=B.ID where B.ID is null
Same query using Not Exist would be
Select A.* from A where not exists (select 1 from B where A.ID=B.ID)
Page 1 of 1
|
|

New Topic/Question
Reply


MultiQuote



|