gtjr92
Programmer
- May 26, 2004
- 96
I am trying to get a count of entries per month. The date created field is the field that holds the date of an entry.
When i run the below query it only gives me data from one day for each month, it does not iterate through the whole month. How can i have it so it will give me the total count from each month.
When i run the below query it only gives me data from one day for each month, it does not iterate through the whole month. How can i have it so it will give me the total count from each month.
Code:
Select
distinct datename(Month,DateCreated)As Month,
datepart(Month,DateCreated)As Monthid,
datepart(year,DateCreated) As Year,
count(*) As EntryCount
from blog_entry
WHERE blog_Entry.IsDeleted = 0 and
datename(Month,DateCreated)=datename(Month,DateCreated)
group by datecreated
order by monthid,year