看一看这个语句为什么执行这么慢
update kq_record set dtime=(select top 1 kqdtime from kq_kqlogdata where empid=kq_record.empid and kqdtime>=kq_record.oktime and kqdtime<=dateadd(mi,@minsLate+kq_record.setlongtimes,kq_record.oktime)),errtype=-1 where departid=@depid and upordown=1 and oktime>@stime and oktime<@etime and kqtype in (0,-2,-3) and (select count(id) from kq_kqlogdata where empid=kq_record.empid and kqdtime>=kq_record.oktime and kqdtime<=dateadd(mi,@minsLate+kq_record.setlongtimes,kq_record.oktime))>0目标是:考勤分析.
kq_record中有需要考勤的数据,其中oktime为考勤目标时间,而kq_kqlogdata是来自考勤机上的原始记录