replacing multiple not exists with join
865947Jun 1 2011 — edited Jun 6 2011Hi
I need to replace multiple not exists (see below) with join to get better performace (hopefully) but not able to figure out..........any help ???
select * from Table1 where exists (select 'x' from Table2 where Table1.COL1 = Table2.COL1
and TEST1 = '1' and exists (select 'x' from Table3 where Table2.ID = Table3.ID
and TEST2 = '1'))
and not exists (select 'x' from Table4
where Table1.COL2 = Table4.COL2 and Test3='A')
and not exists (select 'x' from Table5
where Table1.COL2 = Table5.COL2 and Test4='B')
-- here Table1, Table2.... are alias used for actual tables.
Thanks in advance......
Edited by: 862944 on Jun 1, 2011 9:50 AM