This will help to see the full request. For each date value that exists in stats , you must either get NULL for the sum or integer value. If you group [Date] and the given date value does not exist, it obviously will not be displayed. For example, consider the following test:
Create Table Test ( Clicks int null, [Date] datetime null ) Insert Test(Clicks,[Date]) Values(1,'2010-06-06') Insert Test(Clicks,[Date]) Values(2,Null) Insert Test(Clicks,[Date]) Values(3,'2010-06-06') Insert Test(Clicks,[Date]) Values(4,'2010-06-07') Insert Test(Clicks,[Date]) Values(4,Null) Insert Test(Clicks,[Date]) Values(4,'2010-06-07') Insert Test(Clicks,[Date]) Values(Null,'2010-06-08') Select T.[Date], Sum(Clicks) From Test T Group By T.[Date]
The results should look like this:
NULL 6 2010-06-06 00:00:00.000 4 2010-06-07 00:00:00.000 8 2010-06-08 00:00:00.000 NULL
Note. I still get the string even when Sum(Clicks) is NULL. Is it that you attach this information to something else when calculating Sum(Clicks) ?
Thomas
source share