I'm using MS SQL Server 2005. I need to change the values in POItem but have to isolate the records using POItem and PurchaseOrder. I can't seem to get it right. This is the code that gives me the records I want. I can't figure out how/where to put the UPDATE and SET command to change the value of POItem.FinalInvoice. I need to switch it from 0 to 1 in those records.
Any help would be appreciated.
Thanks,
Lorraine
Code:
USE LMCopy
SELECT PurchaseOrder.PurchaseOrderN, PurchaseOrder.DateOrdered, POItem.POItemN, POItem.FinalReceipt, POItem.FinalInvoice
FROM LMCopy.dbo.POItem POItem, LMCopy.dbo.PurchaseOrder PurchaseOrder
WHERE POItem.PurchaseOrderN = PurchaseOrder.PurchaseOrderN AND PurchaseOrder.PurchaseOrderN<>2549629 AND ((POItem.FinalReceipt<>1) AND (PurchaseOrder.DateOrdered<{ts '2010-01-01 00:00:00'}) OR (PurchaseOrder.DateOrdered<{ts '2010-01-01 00:00:00'}) AND (POItem.FinalInvoice<>1))
Any help would be appreciated.
Thanks,
Lorraine