UPDATE IC SET IC.InvoiceSiteID = (CASE WHEN IC.SiteID IN(SELECT InvoiceToSite FROM QuoteInvoicing WHERE QuoteID = IC.QuoteID) THEN InvoiceToSite ELSE MIN(InvoiceToSite) FROM QuoteInvoicing WHERE QuoteID = IC.QuoteID AND InvoiceToSite <> IC.SiteID END) FROM #InvoiceConsolidation IC INNER JOIN QuoteInvoicing IQ ON IC.QuoteID = IQ.QuoteID
|Syntax error [Missing Operator] in query expression||7||55|
|How can I update a 2nd table with what is inserted into the 1st?||5||35|
|sql server concatenate fields||10||31|
|TSQL - How to declare table name||26||28|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
9 Experts available now in Live!