本周、上周、本月、上月、今年、去年、全部
管理数据表自定义标签写入后对报表数据主界面数据分类
- 本周@[日期]>=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
复制代码
本周@[日期]>=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
|
|
hessen