日期:2014-05-18 浏览次数:20543 次
declare @username nvarchar(20),@starttime datetime,@endtime datetime set @username='用户1';set @starttime='2012/3/4 00:00:00'; set @endtime ='2012/3/10 23:59:00'; select case when datepart(dw,timestr)=1 then contentstr end as sunday , case when datepart(dw,timestr)=2 then contentstr end as monday , case when datepart(dw,timestr)=3 then contentstr end as tuesday , case when datepart(dw,timestr)=4 then contentstr end as Wednesday , case when datepart(dw,timestr)=5 then contentstr end as Thursday, case when datepart(dw,timestr)=6 then contentstr end as Friday, case when datepart(dw,timestr)=7 then contentstr end as Saturday from (select contentstr,timestr from ERPWorkRiZhi where username=@username and timestr BETWEEN @starttime and @endtime) as a;