本年的最后一天 SELECT dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate())+1, 0))
10.本月的第一个星期一...select DATEADD(wk,DATEDIFF(wk,0,dateadd(dd,6-datepart(day,getdate()),getdate())), 0)
11.查询本周注册人数...select count(*) from [user] where datediff(month,create_day,getdate())=1
如果要效率,这样写查询...1.查询本周注册人数 select count(*) from [user] where create_day>=dateadd(day,2-datepart(weekday...本月第一天:select dateadd(dd,-day(getdate())+1,getdate())
本月最后一天:select dateadd(dd,-day(getdate(