this is db2, right?
no idea why it isn’t working, it looks okay to me, but i don’t have db2 myself, so i can’t test this
, days(TMSTP_COL) as days_timestmp
from (SELECT COUNT(*) as thecount
FROM MYTAB A
GROUP BY TMSTP_COL
HAVING COUNT(*) > 1) as dt
order by thecount desc