3
I’m trying to make a SUM in a query that performs some calculations. Follow the example:
SELECT
SUM ( (qtd - qtd_devolucao) * valor AS total)
FROM
produtos
WHERE
id_pedido = '47'
I’m having the following mistake:
#1064 - You have a syntax error in your SQL next to 'Total AS')
You want the sum to be called
total?– Maniero
I want to add all the
total– Hugo Borges
And what is the expression that forms the
total?– Maniero
I want the
totalreceives(qtd - qtd_devolucao) * valorThen I want to have asumin thetotal.– Hugo Borges