I have a query to show some field :
EMPL_KODE | EMPL_NAME | TIME_IN | TIME_OUT | TOTAL_MINUTES | TOTAL_HOURS
====================================================================
SELECT EMPLOYEE.EMPL_KODE, EMPLOYEE.EMPL_NAME,
CAST(ATTANDENCE.DATE_IN + ATTANDENCE.TIME_IN AS TIMESTAMP) AS "TIME_IN",
CAST(ATTANDENCE.DATE_IN + ATTANDENCE.TIME_OUT AS TIMESTAMP) AS "TIME_OUT",
DATEDIFF(MINUTE,ATTANDENCE.TIME_IN,ATTANDENCE.TIME_OUT) AS "TOTAL_MINUTES",
DATEDIFF(HOUR, ATTANDENCE.TIME_IN,ATTANDENCE.TIME_OUT) AS "TOTAL_HOURS"
FROM EMPLOYEE
JOIN ATTANDENCE
ON EMPLOYEE.EMPL_KODE=ATTANDENCE.EMPL_KODE
GROUP BY EMPLOYEE.EMPL_KODE, EMPLOYEE.EMPL_NAME;
It shows error message like this :
Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)
What's wrong with my code ? Can you help me please ?
Aucun commentaire:
Enregistrer un commentaire