Count equal date parts of the timestamp column ACROSS the groups by the said column
问题 I would like to count duplicate date values. I already know that my field "WHEN" is a timestamp, so I have to cast it to type of date. my actual query looks like this: SELECT u.USERNAME, r."WHEN", r.UPDATEINOUT, case (r.UPDATEINOUT) when 0 then 0 when 1 then 1 else r.INOUT end INOUT FROM ATTENDANT r LEFT JOIN USERS u ON r.USERID = u.ID where u.USERNAME = 'rk' and (r.UPDATEINOUT = 1 or r.UPDATEINOUT = 0 or r.UPDATEINOUT is null) group by r."WHEN", INOUT, u.USERNAME, r.UPDATEINOUT order by r.