必须多加一个字段sq_id,记录打卡的时间段;例如上午上班sq_id=1,上午下班sq_id=2,下午上班sq_id=3,下午下班sq_id=4,第二天上午上班sq_id=5......数据太多,必须循环Employeeid insert into 临时表select distinct a.Employeeid, b.Employeeid from 考勤记录表 a, 考勤记录表 b where b.KqTime <= a.KqTime + 1分钟 and a.Employeeid <> b.Employeeid and a.sq_id = b.sq_id and a.sq_id = 1 and a.Employeeid = 999intersectselect distinct a.Employeeid, b.Employeeid from 考勤记录表 a, 考勤记录表 b where b.KqTime <= a.KqTime + 1分钟 and a.Employeeid <> b.Employeeid and a.sq_id = b.sq_id and a.sq_id = 2 and a.Employeeid = 999intersectselect distinct a.Employeeid, b.Employeeid from 考勤记录表 a, 考勤记录表 b where b.KqTime <= a.KqTime + 1分钟 and a.Employeeid <> b.Employeeid and a.sq_id = b.sq_id and a.sq_id = 3 and a.Employeeid = 999intersectselect distinct a.Employeeid, b.Employeeid from 考勤记录表 a, 考勤记录表 b where b.KqTime <= a.KqTime + 1分钟 and a.Employeeid <> b.Employeeid and a.sq_id = b.sq_id and a.sq_id = 4 and a.Employeeid = 999