is this query in its most simplied form?
()a is a big UNION (the code goes between ())
and b() is a simpler query with conditions
the below logic is perfect.. but not sure how efficient it is... can you review it please?
select * from
() a /*a - this has 7 big unions within the () */
where not exists
(select 0 from ()b where a.key1=b.key1 and a.key2 = b.key2) /*b- This is a two table join with 3 conditions */