我正在尝试了解员工迟到的频率
到目前为止我用过这个
SELECT EMPID
,EMPNAME
,COUNT(TimeIn) AS LATECOUNT FROM
(SELECT EMPLOYEEID AS EMPID, EmployeeName AS EMPNAME, AbsenceDate AS ABSDAT, MIN(TimeIn) AS TimeIn
FROM dbo.viewAttendance
GROUP BY AbsenceDate, EMPLOYEEID, EmployeeName
HAVING (MIN(TimeIn) > '08:00:00')
) AS a
使用该代码,我只能检索只有至少一名迟到的员工的行(仅返回 30 行)。我真正想要的是 300 行(所有员工)的完整回报,显示他们的迟到数量。我的头脑不够清晰,无法找到正确的语法。我知道问题出在 HAVING (MIN(timeIn) > '08:00:00' 有人可以帮助我吗?提前谢谢... :)