finding records in one table but not the other
I am writing some queries which are designed to return rows from one table which have no matching records in the other.
The following takes around half a minute or so and is the best solution I've come up with so far:
select a.orderid,a.part,a.qty,b.partflag from
(select orderid,part,qty from tblorder1 where qty > 0
and not exists
( select id from tblorder2 where qty > 0
and orderid = id
)a,
(select part,partflag from iteminfo)b
where a.part = b.part
The 2 main subsections return around 600-700 records each.
Is there any speedier way of obtaining records in the first table but not the other ?
I've tried outer join format and that's even slower.