-1
Since I don’t know how to explain my problem, I’ll give you an example:
select cod_prod, sum(quantidade) as "Quantidade 2013", sum(quantidade) as "Quantidade 2014"
from itens
group by cod_prod
having "Quantidade 2013" in ...
The above example is not working because it does not recognize the name "Quantity 2013".
My question is:
How do I find a way to differentiate one sum(quantity) from the other so that I can manipulate them differently in the having method?
Details:
Maybe it is the case of the use of CASE , no pun , to treat the year 20xx
– Motta
@Motta probably case 2013 adds up the field, or zero, but here comes the problem of having, because depending on the DB it can use alias, depending on the DB has to repeat the formula. It would be important he [Dit] and add the details
– Bacco
@Motta added new details to help in understanding the problem
– João Castilho
@Bacco added new details to help in understanding the problem
– João Castilho