3
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 have the following result:
|  Data  |TotalVer|TotalBra|
|04.09.18|   60   |  70    |
|05.09.18|   50   |  10    |
I’m trying this way, but it’s making a mistake:
select
case when QTCxVer <> 0 then
  sum(Quantidade) as "TotalVer"
else
  sum(Quantidade) as "TotalBran"
end
from tb_teste
 group by  data
what error? ah, no "date" failed in select?
– Ricardo Pontual
you need to add up the two columns...
– Rovann Linhalis