0
I am trying to perform an UPDATE and it brings me the following error: "Message 157, Level 15, Status 1, Line 40 - An Aggregate may not appear in the set list of an UPDATE statement."
Follow the UPDATE code:
UPDATE Venda_Cartao SET
Venda_Cartao.ID_Caixa = (SELECT distinct ID_Caixa FROM Caixa_Movimentacao a
where a.ID_Forma_Pagamento = 3 and a.Valor = convert(decimal(18,2),
convert(decimal(18,2),SUM(vc.Valor_Pago))) and DAY(Data_Movimentacao) =
DAY(vc.Data) and MONTH(Data_Movimentacao) = MONTH(vc.Data) and
YEAR(Data_Movimentacao) = YEAR(vc.Data)) from Venda_Cartao vc
where vc.ID_Caixa is null
The Issue is answered in this stackoverflow. Syntax does not favor the purpose of the script. Thanks.
– rammonzito
Explain what the query should perform, tables involved etc so that it is possible to post suggestions.
– José Diz