Hi I have an SQL server database with 3 columns Activity[start_date(datetime),end_date(datetime),title(string)]
and I wish to count for a whole year, how many activities have start_date in each month, I mean I would like a return of 12 values(12 months) that count the activities within the months, thanks.
Hi I have an SQL server database with 3 columns Activity[start_date(datetime),end_date(datetime),title(string)] and I wish
Share
If there is an index on
start_dateand/or if you need to include months in the result even if there was no activity in that month, you might consider this one:(If you don’t want a row when there were zero activities in a given month, then change
LEFT OUTERtoINNER.)