Page 1 of 1

query

PostPosted: Wed Apr 04, 2018 7:10 pm
by tonys
Hi Mike or Scott,

I am trying to do an update query to set the status of a quote to closed if it has been converted to a sales order.

I tried the following without success. Could you help please.


update qo_main
set status = 1
WHERE QO_History.InvoiceHistoryID in (SELECT so_main.SourceQuoteHistoryID FROM SO_Main)
JOIN QO_Main on QO_Main.InvoiceID = QO_History.InvoiceID

Re: query  Topic is solved

PostPosted: Thu Apr 05, 2018 9:36 am
by Scott.Pearce
Code: Select all
UPDATE QO_Main
SET Status = 1
WHERE QO_Main.InvoiceID IN
              (
              SELECT QO_Main.InvoiceID
              FROM QO_Main
              JOIN QO_History ON QO_Main.InvoiceID = QO_History.InvoiceID
              WHERE QO_History.InvoiceHistoryID IN (SELECT SourceQuoteHistoryID FROM SO_Main)
              )

Re: query

PostPosted: Sat Apr 07, 2018 9:42 pm
by tonys
Thank you Scott that worked a treat.