我有一张供员工打卡/打卡的考勤表,布局如下:
employeeID Clock-in DateTime Clock Type
1004 24/09/2013 13:08 in
1004 25/09/2013 00:50 out
1005 24/09/2013 12:08 in
1005 25/09/2013 03:55 out
2003 24/09/2013 10:06 in
2003 24/09/2013 15:42 out
2003 24/09/2013 17:33 in
2003 24/09/2013 22:17 out
我怎样才能让它像:
Date employeeID Clock-in Clock-out time worked (in hours to 2 decimal place)
24/09/2013 1004 24/09/2013 13:08 25/09/2013 00:50 xx.xx
24/09/2013 1005 24/09/2013 12:08 25/09/2013 03:55 xx.xx
24/09/2013 2003 24/09/2013 10:06 24/09/2013 15:42 xx.xx
24/09/2013 2003 24/09/2013 17:33 24/09/2013 22:17 xx.xx
笔记:
- 员工可以有多个打卡/打卡(即上午/下午,夜班)
- 日期从
04:00:00
到03:59:59
(即在上面的例子中,都归类为24/09/2013
) - 我如何处理没有打卡的记录?我可以设置类似 if
null
,时间等于下一个日期03:59:59
吗?
提前致谢。
我用 jods 的建议更新了以下内容:
3组进出记录示例
EmployeeID CardDate PunchType
1000 21/09/2013 07:43 in
1000 21/09/2013 11:29 out
1000 21/09/2013 12:39 in
1000 21/09/2013 20:37 out
1000 21/09/2013 21:58 in
1000 22/09/2013 00:16 out
您的查询返回
Date EmployeeID clockInTime clockOutTime
21/09/2013 1000 07:43:57 00:16:22
21/09/2013 1000 21:58:40 11:29:22