3
I have a database in Mysql.
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 courtesy,
would be a sumif
..
Select needs to stay that way:
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?
What result are you having and why it is not as expected?
– Sorack