› Fóruns › SQL e PL/SQL › Decode – Selecionar Campo a preencher › Decode – Selecionar Campo a preencher
18 de maio de 2010 às 1:22 am
#94048
Participante
É só acrescentar uma coluna sem o decode, pois é ele quem faz a separação por mês:
select sum(l.valor * case when credito is not null then 1
when debito is not null then -1 end)) total
from clanca l;