2
I am trying to execute the following select command:
SELECT
estoque.id,
produto.id,
produto.descricao PRODUTO,
case saida.quant when > 0 then (estoque.quant + sum(saida.quant)) else estoque.quant end ESTOQUE
FROM estoque, saida, produto
join produto on estoque.idProduto = produto.id
join saida on estoque.id = saida.idEstoque
where estoque.idUnidade = '0'
group by estoque.id
I get an error in the case line where you have the symbol >
. He says he’s not allowed to be there.
My intention is that, should saida.quant
is greater than zero, it sums up with estoque.quant
, when less than zero, list only estoque.quant
How to know if it is greater than zero or less?
– Italo Rodrigo
@Italorodrigo is possible to be smaller?! Logic is that if it is 0 do something else, consider all values. I will edit to improve this.
– viana