Subject Grouping by Year, Month??
Author Clément Doss
Hi All,

I am using a DIALECT 1 database.
I would like to group the records by Year/Month.
The table contains severals entries for each day.
I would like to sum by Year and month the totals.
I already tried the following query :

select extract( year from DATA_CHEGADA) as Ano,
extract( month from DATA_CHEGADA) as Mes,
TIPO,
SUM (VALOR_COBERTO) as Total,
sum(1) as Atendimentos
from PDX_ATND23
where DATA_CHEGADA between '01/01/1998' and '12/31/1998'
group by
extract( year from DATA_CHEGADA),
extract( month from DATA_CHEGADA),
TIPO

order by TIPO, DATA_CHEGADA

Statement #1:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 9, char 6.
extract.

I guess the "group by extract" is not working for me. Any other suggestions?
How can I achieve that?

Best regards,
Clément