我正在尝试在 Access 2000 db 中执行以下查询,但我总是在 Diff 字段中得到#ERROR。请帮我修复它。
PARAMETERS [Enter Date] DateTime;
SELECT sub.Emp_ID, sub.Name, Dept, sub.Day, sub.Attending, sub.Leaving, sub.Leaving - sub.Attending AS Diff
FROM [SELECT
M.EmpID AS Emp_ID,M.Name,M.Dept,
IIf (IsNull(H.EventDate), "NP", H.EventDate) AS [Day],
MIN(H.EventTime) AS Attending,
MAX(H.EventTime) AS Leaving
FROM
Member AS M
LEFT JOIN History AS H
ON
(M.UserID = H.EventUserID
AND Format([EventDate], "dd/mm/yyyy") = [Enter Date])
WHERE
M.EmpID NOT IN (select EmpID from exceptionList)
GROUP BY
M.EmpID, M.Name, M.Department,EventDate
]. AS sub
ORDER BY sub.Emp_ID;