我正在尝试找到一种方法来填充矩阵中没有数据的日期。
但我也想显示两者之间的所有日期。我尝试了几种不同的iif语句,但是我得到了错误或没有任何变化。
SELECT ee.No, TTMain.CustFn, me.Date_Opened AS [I Open], me.Date_Closed AS [I Sch Close], TTMain.ttfn00, ee.Cls_Date AS [Actual Close Date], ee.Open_Date, TTMain.Project FROM GreatAmerican_Data.dbo.Marketing_Escrow AS me INNER JOIN GreatAmerican_Data.dbo.Escmst_Escrow AS ee ON me.File_Number = ee.No INNER JOIN ttMain AS TTMain ON ee.No = TTMain.ZeroZerottfn WHERE (ee.Branch = '018') AND (me.Date_Opened Between '2/1/16' AND GETDATE()) AND (ee.Status_Date IS NULL) ORDER BY [I Sch Close]
例子:
declare @tbMonth as Table (DayOfMonth nvarchar (10)) insert into @tbMonth ('01 Feb') insert into @tbMonth ('02 Feb') insert into @tbMonth ('03 Feb') insert into @tbMonth ('04 Feb')
… 等等
@tbMonth
[DayOfMonth]