Hi all,For reporting purpose, I need to pull the whole calendar date with default value fill-in, even no data exist. Below is sample, expect for the report, which was from my simple approach. I need help to put this in a better coding.thanksDECLARE @EndDate datetimeDECLARE @StartDate datetimedeclare @tbl1 table(id int, reading float, readdate datetime) SET @StartDate = CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(GETDATE())-1),GETDATE()),101)SET @EndDate = CONVERT(VARCHAR(25),DATEADD(dd,-(DAY(DATEADD(mm,1,GETDATE()))),DATEADD(mm,1,GETDATE())),101) insert into @tbl1select 1, 999, '05/01/2012'union all select 2, 999, '05/02/2012'union allselect 1, 999, '05/05/2012'union all select 2, 999, '05/05/2012'union allselect 1, 999, '05/015/2012'union all select 2, 999, '05/13/2012';WITH Dates(DATEPARAM) AS( SELECT @StartDate AS datetime UNION ALL SELECT DATEADD(DAY, 1, DATEPARAM) FROM Dates WHERE DATEPARAM < @EndDate)--out put expectselect DATEPARAM as ReadDate, isnull(ID,1)as id, isnull(reading ,800) as reading from Dates left join@tbl1 on Dates.DATEPARAM=readdateand id=1union all select DATEPARAM, isnull(ID,2), isnull(reading ,800) from Dates left join@tbl1 on Dates.DATEPARAM=readdateand id=2