I have a MySql database.
No_Pedido|Valor|Cortesia
123|1000|Sim
123|500|Nao
124|200|Nao
124|500|Nao
I need to make a select that returns the sum of the value per request that is not polite,
would be sumif
..
Select needs to look like this:
No_Pedido|Valor|Cortesia
123|500|Nao
124|700|Nao
To using the following query:
select sum(case when cortesia = 'Sim' then valor else 0 end) from tabela;
And the result is not as expected ...
Any suggestions?