As I can not explain my problem well, 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 arrange a way to differentiate one sum from the other so that I can manipulate them differently in the having method?
Details: