set datefirst 1 select count(*) from
(select date from(select dateadd(dd,number,‘2015-01-01‘) date from master..spt_values where [type] = ‘p‘ and number >= 0 and number < datediff(dd,‘2015-01-01‘,‘2016-01-01‘)) t
where datepart(week,date) = (select DATENAME(week,@date))) a , bbreport b
where substring(b.date,1,10) = convert(char(10),a.date,120) and cmsid=‘014811‘
时间: 2024-10-29 21:16:06