I have the following structure:
| Data |Quantidade|QTCxVer|QTCxBra|
|04.09.18| 10 | 1 | |
|04.09.18| 30 | | 3 |
|04.09.18| 40 | | 4 |
|04.09.18| 50 | 5 | |
|05.09.18| 20 | 2 | |
|05.09.18| 10 | | 1 |
|05.09.18| 30 | 3 | |
I want to get the following result:
| Data |TotalVer|TotalBra|
|04.09.18| 60 | 70 |
|05.09.18| 50 | 10 |
I'm trying this way, but it's giving error:
select
case when QTCxVer <> 0 then
sum(Quantidade) as "TotalVer"
else
sum(Quantidade) as "TotalBran"
end
from tb_teste
group by data