|
Group By In Db2
I have the sql statement:
SELECT MONTH(DATA_PAGAMENTO) AS MONTH, YEAR(DATA_PAGAMENTO) AS YEAR, ANO_JUROS, SUM(VALOR_JUROS)
FROM GCON.JUROS_ELETROBRAS
WHERE ANO_JUROS = 2004
GROUP BY MONTH(DATA_PAGAMENTO), YEAR(DATA_PAGAMENTO), ANO_JUROS
ORDER BY MONTH, YEAR, ANO_JUROS
I want to use this statement with DB2 database. When i execute the statement i receive the message:
SQL0104N An unexpected token "(" was found following "". Expected tokens may
include: "FOR WITH FETCH ORDER UNION EXCEPT QUERYNO OPTIMIZE ".
SQLSTATE=42601
Someone has any suggestion?? I need group by the rows by month and year of a date value.
thanks!!
|