Como fazer uma consulta com group by por DATA ??? URGENTE !!

Firebird

17/11/2003

Uso o INTERBASE e tenho uma tabela chamada PARCELA com um campo DT_VENCTO formato data(dd/mm/aaaa) e VL_PARCELA no formato double.

Tenho que fazer uma consulta do campo SUM(VL_PARCELA) com group by DT_VENCTO mas no formato (mm/aaaa). como fazer essa consulta já que interbase não aceita a função substring()???

Obrigado,

Douglas Pires


Dgpires

Dgpires

Curtidas 0

Respostas

Afarias

Afarias

17/11/2003

1 crie uma view::

create view VW_PARCELA (MesAno, DT_VENCTO, VL_PARCELA) as
select cast(extract(month from DT_VENCTO) as char(2))||´/´||cast(extract(year from DT_VENCTO) as char(4)), DT_VENCTO, VL_PARCELA from PARCELA;


e use a VIEW::

select MesAno, SUM(VL_PARCELA) from vw_parcela
group by MesAno;


T+


GOSTEI 0
POSTAR