查询连续N天有考勤记录的数据
作者:admin 日期:2013-06-07
查询连续N天有考勤记录的数据
with t
as(
select
px=DATEADD(DD,-ROW_NUMBER()over(partition by Pid
order by [RDate] asc),[RDate]),
[Pid], [RDate]
from Att_Raw_Data
where [RDate]>'2013-05-01'
group by rdate ,pid
),
m as(
select [Pid],MIN([RDate]) as StartTime,MAX([RDate]) as EndTime
复制内容到剪贴板 程序代码
with t
as(
select
px=DATEADD(DD,-ROW_NUMBER()over(partition by Pid
order by [RDate] asc),[RDate]),
[Pid], [RDate]
from Att_Raw_Data
where [RDate]>'2013-05-01'
group by rdate ,pid
),
m as(
select [Pid],MIN([RDate]) as StartTime,MAX([RDate]) as EndTime