review sql querry

G

Guest

hi I use in my application a following querry:

UPDATE tbInvoice SET inPrinted=1
WHERE delID = ANY (SELECT deID from q_Deliveries
WHERE deDate>= #09/13/2006#
AND deDate <= #09/13/2006#)

This querry marks all invoices as Printed (tbInvoice.inPrinted =1 ) within a
range of date which comes from a form. The querry works fine, but is quite
slow. Is there any other way how to replace ANY in the querry?

thanks
 
J

John Spencer

Try:

UPDATE tbInvoice
SET inPrinted=1
WHERE delID IN (SELECT deID from q_Deliveries
WHERE deDate>= #09/13/2006#
AND deDate <= #09/13/2006#)

If performance is slow, I would also set indexes on delID, deID, and deDate.

q_Deliveries could also be what is causing the slowdown, but you haven't
posted that SQL.
 
G

Guest

John, I have already tried replace ANY with IN, but it did not work. Anyway,
I think you are right the issue does not seem to be in this particular
querry, but with the subquerry q_Deliveries which is quite complex. I will
try to simplify it.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top