This should be simple enough but something's gotten me big time.
All I have is a table with just TWO columns, something like:
WordCount DateAdded
`````````````````````````````
96 2008-11-07 09:16:31.810
32 2008-11-07 15:26:27.547
25 2008-11-23 16:05:39.640
62 2008-12-03 12:33:03.110
and so on.
I want to calculate the total word count for each day - I group them by dateadded and select sum of WordCount and finally get the syntax error (wordcount has to be in group by clause) but now I am getting nulls for day's count
This is my query:
select SUM(WordCount) as 'words per day' from @WordsCount group by DateAdded, WordCount
this is selecting just null. How can I know what is wrong?
thanks.
What if you use:
I don't see why you're also grouping by the word count....
Also, since the
DateAdded
likely is aDATETIME
column including a time portion, you might want to group by just the date:Update: if I try this, the query works just fine ....
and produces the output:
I think this should give you word count per day