Bill Gribble wrote:
>I just did this today for a query and got a 200x speedup when
>converting from IN to EXISTS. It's dependent on your specific query
>exactly how to do the conversion, but generally it's just a question
of >moving a field from the "outside" to the "inside" of the subselect.
If it's not asking too much could you recommend how I could fix this
query? It's a bit more complicated than yours and I can't seem to get
the syntax right.
select distinct invoice_id from invoice_li where received='true'
AND shipped='false' AND cancelled='false'
AND
(invoice_id not in
(
select distinct invoice_id from invoice_li where received='false'
AND cancelled='false'
)
OR ship_now='true'
)
Sorry for the formatting ...
Jc