I have the following SQL SELECT statement...
however, I want it to update the following
But I need to keep the grouping in the select statement.
I can't figure out the best way of doing it...
Can someone help?
Thanks
Code:
SELECT tblSale.[contract number - txt], Sum(dbo_Payments.Amount) AS SumOfAmount
FROM tblCustomer INNER JOIN (tblSale LEFT JOIN dbo_Payments ON tblSale.[contract number - txt] = dbo_Payments.CustomerCode) ON tblCustomer.CustomerID = tblSale.CustomerID
GROUP BY tblSale.[contract number - txt], tblSale.ContractStatusID, tblSale.DDPaid, tblSale.[DDPaid date], dbo_Payments.Date
HAVING (((tblSale.ContractStatusID)=5) AND ((dbo_Payments.Date)<Date()-"5" AND Is not Null) AND ((Sum(dbo_Payments.Amount))>0));
however, I want it to update the following
Code:
SET tblSale.ContractStatusID = 4, tblSale.DDPaid = True
But I need to keep the grouping in the select statement.
I can't figure out the best way of doing it...
Can someone help?
Thanks