一个计数统计问题?
--26天以内和26天以外的数据区分
--目的:按员工计算其产量,同时要区分从指定日期开始前26天和26以后的产量//注意,日期中间可能有中断,也就是说要从指定日期开始按员工计数,看是否已满26天
Create Table #TEST
(rq datetime,--日期
ygname varchar,--员工姓名
cl Int)--产量
Insert #TEST Select 2006-03-26, 'A ', 1
Union All Select 2006-03-27, 'A ', 1
Union All Select 2006-03-28, 'A ', 1
Union All Select 2006-03-29, 'A ', 1
Union All Select 2006-03-30, 'A ', 1
Union All Select 2006-03-31, 'A ', 1
Union All Select 2006-04-01, 'A ', 1
Union All Select 2006-04-02, 'A ', 1
Union All Select 2006-04-03, 'A ', 1
Union All Select 2006-04-04, 'A ', 1
Union All Select 2006-04-05, 'A ', 1
Union All Select 2006-04-06, 'A ', 1
Union All Select 2006-04-07, 'A ', 1
Union All Select 2006-04-08, 'A ', 1
Union All Select 2006-04-09, 'A ', 1
Union All Select 2006-04-10, 'A ', 1
Union All Select 2006-04-11, 'A ', 1
Union All Select 2006-04-12, 'A ', 1
Union All Select 2006-04-13, 'A ', 1
Union All Select 2006-04-14, 'A ', 1
Union All Select 2006-04-15, 'A ', 1