I have my query:
select
(select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 1 )as uno,
(select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 2 )as dos,
(select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 3 )as tres,
(select SUM(cco.Valor) from Temp t where t.cod = cco.cod and cco.costo = 4 )as cuatro
from Cuenta cco
group by
cco.cod,
cco.costo
that is dynamic, by that I mean that within my subqueries I can do more filters, such as date, range of ages, everything is within the subquery