SQL语句如何指定查询某人员前面指定的几条打卡记录数据?
--比如要查周方美所有记录其中的2条打卡记录,张志军4条记录,黎素琴8条记录,请问这个语句如何修改?select*fromFDATETIME,CARDNO,MACHNO,...
--比如要查周方美所有记录其中的2条打卡记录,张志军4条记录,黎素琴8条记录,请问这个语句如何修改?
select * from
FDATETIME,CARDNO,MACHNO,
(select count(empid) from kq_source as a2 where a2.EMPid=a1.EMPid and a2.fdatetime>=a1.fdatetime
) as SOURCE
from kq_source AS a1) AS B
where fdatetime>dateadd(month,-2,fdatetime)
and substring(convert(varchar,fdatetime,108) ,1,2) + ':' + substring(convert(varchar,fdatetime,108) ,4,2)>'17:40'
--and source<=
ORDER BY empid DESC,FDateTime
备注:SQL SERVER 2000数据库,要查的数据量不是像固定的(如2,4,8),这只是一个例子. 展开
select * from
FDATETIME,CARDNO,MACHNO,
(select count(empid) from kq_source as a2 where a2.EMPid=a1.EMPid and a2.fdatetime>=a1.fdatetime
) as SOURCE
from kq_source AS a1) AS B
where fdatetime>dateadd(month,-2,fdatetime)
and substring(convert(varchar,fdatetime,108) ,1,2) + ':' + substring(convert(varchar,fdatetime,108) ,4,2)>'17:40'
--and source<=
ORDER BY empid DESC,FDateTime
备注:SQL SERVER 2000数据库,要查的数据量不是像固定的(如2,4,8),这只是一个例子. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询