On a SELECT query i want to convert my DATETIME column to DATE format (taking only year, month and day).
I was using DATE construct: DATE(table.column) and it was great but it seems that this construct doesen't works on SQLSERVER databases (i was working on MySql previously).
This is the error i met:
data type for node: org.hibernate.hql.ast.tree.MethodNode +-[METHOD_CALL] MethodNode: '(' | +-[METHOD_NAME] IdentNode: 'DATE'
Someone can help me fix this? I tried using CONVERT and CAST but i met same error.
This is the query:
SELECT DATE(al.loginTime) as loginTime, (COUNT(al.hawkUser)) as numeroAccessi, al.hawkUser as hawkUser, al.logoutTime as logoutTime " +
"FROM AccessLog as al GROUP BY al.hawkUser, DATE(al.loginTime) ORDER BY DATE(al.loginTime) DESC, al.hawkUser DESC