本帖最后由 jiangliu296 于 2017-10-9 16:27 编辑
标签写法如下:
本周@[发起时间]>=CONVERT(nvarchar(10), DATEADD(wk, DATEDIFF(wk,0,DATEADD(dd, -1, getdate()) ), 0),23) and [发起时间]<= CONVERT(nvarchar(10), DATEADD(wk, DATEDIFF(wk,0,DATEADD(dd, -1, getdate()) ), 6),23)|
上周@[发起时间]>=CONVERT(nvarchar(10),DATEADD(wk, DATEDIFF(wk,0,DATEADD(dd, -7, getdate()) ), 0),23) and [发起时间]<= CONVERT(nvarchar(10), DATEADD(wk, DATEDIFF(wk,0,DATEADD(dd, -7, getdate()) ), 6),23)|
本月@[发起时间]>=CONVERT(nvarchar(10),dateadd(dd,-day(getdate())+1,getdate()),23)and [发起时间]<=CONVERT(nvarchar(10),dateadd(dd,-day(getdate()),dateadd(m,1,getdate())),23)|上月@[发起时间]>=CONVERT(nvarchar(10),dateadd(dd,-day(dateadd(month,-1,getdate()))+1,dateadd(month,-1,getdate())),23)and [发起时间]<=CONVERT(nvarchar(10), dateadd(dd,-day(getdate()),getdate()),23)|
今年@YEAR([发起时间]) = YEAR(GETDATE())|
去年@YEAR([发起时间]) = YEAR(GETDATE()) - 1|
全部@1=1
注:[发起时间]替换为你需要判断的日期字段
|
|
jiangliu296