询问
SELECT
TIMECARD.EMP_ID, TIMECARD.TIMECARD_ID, TIMECARD.TIMECARD_STATUS,
TASK.MAN_HOURS
FROM
TRN_TIMECARD_ACTIVITY ACT
INNER JOIN
TRN_TIMECARD TIMECARD ON TIMECARD.TIMECARD_ID = ACT.TIMECARD_ID
INNER JOIN
TRN_TIMECARD_TASK TASK ON TASK.TIMECARD_ID = TIMECARD.TIMECARD_ID
WHERE
ACT.TIMECARD_STATUS IN ('AP','RE')
输出:
61 42 AP 9
61 42 AP 9
61 43 AP 9
61 43 AP 9
61 47 AP 7
我必须分组emp_id
并计算sum(man_hours)
。
如何获得如下价值
61 42 AP 52