1: 业务场景
员工考勤打卡,分早,晚打卡,早上8:00到9:00 为早上打卡时间,这个时间范围内第一次打卡视为有效打卡,本时间段内其它打卡视为重复打卡;
相同情况,晚上下班打卡时间范围为17:00到18:00,这个时间范围内的第一次打开视为有效打卡,本时间内的其它打卡视为重复打卡;
其余时间范围内的打卡视为无效打卡
2:数据准备
Create table T_ClockIn (
UserId int,
CheckIn date
);
Insert into T_ClockIn VALUES (1,'2018/12/1 8:25');
Insert into T_ClockIn VALUES (1,'2018/12/1 8:26');
Insert into T_ClockIn VALUES (1,'2018/12/1 17:02');
Insert into T_ClockIn VALUES (1,'2018/12/2 8:27');
Insert into T_ClockIn VALUES (1,'2018/12/2 8:37');
Insert into T_ClockIn VALUES (1,'2018/12/2 17:27');
Insert into T_ClockIn VALUES (1,'2018/12/2 18:27');
Insert into