Is there a reason why I cannot use a SCALAR function in a Group BY clause?
I have a table with a column that is of type timestamp. I want to get a count of all dates for which there are multiple rows. So I devise a query of the sort
SELECT COUNT(*), DAYS(TMSTP_COL)
FROM MYTAB A
GROUP BY DAYS(TMSTP_COL)
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC
I get an error
DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL "(".
I know it is complaining about the DAYS function since the moment I remove it, the error goes away
December 30, 2004 2:15 PM
October 21, 2009 1:33 AM