我在 MS Access 2007 中查询 sql。我想用 datetime 找到 mix 和 max 函数。
此代码:
SELECT inf.SSN AS EmpNo, ck.CHECKTIME AS CHKDATE,Min(ck.CHECKTIME) AS TIMEIN, Max(ck.CHECKTIME) AS TIMEOUT
FROM CHECKINOUT ck INNER JOIN USERINFO inf ON ck.Badgenumber = inf.Badgenumber
WHERE (((ck.CHECKTIME)>=#20/03/2013#)
Group By inf.SSN, ck.CHECKTIME
ORDER BY inf.SSN, ck.CHECKTIME
结果:
EmpNo | CHKDATE | TIMEIN | TIMEOUT
1290005 | 20/3/2556 7:24:52 | 20/3/2556 7:24:52 | 20/3/2556 7:24:52
1290005 | 20/3/2556 19:07:54 | 20/3/2556 19:07:54 | 20/3/2556 19:07:54
1290005 | 21/3/2556 7:14:29 | 21/3/2556 7:14:29 | 21/3/2556 7:14:29
1320004 | 20/3/2556 7:28:57 | 20/3/2556 7:28:57 | 20/3/2556 7:28:57
1320004 | 20/3/2556 17:05:23 | 20/3/2556 17:05:23 | 20/3/2556 17:05:23
1320004 | 21/3/2556 7:15:30 | 21/3/2556 7:15:30 | 21/3/2556 7:15:30
但我想要结果:
EmpNo | CHKDATE | TIMEIN | TIMEOUT
1290005 | 20/3/2556 00:00:00 | 20/3/2556 7:24:52 | 20/3/2556 19:07:54
1290005 | 21/3/2556 00:00:00 | 21/3/2556 7:14:29 | 21/3/2556 7:14:29
1320004 | 20/3/2556 00:00:00 | 20/3/2556 7:28:57 | 20/3/2556 17:05:23
1320004 | 21/3/2556 00:00:00 | 21/3/2556 7:15:30 | 21/3/2556 7:15:30
如何在 Access 2007 中查询此结果。感谢您的宝贵时间。;)