Month & year stats
Date: 11/06/07
(SQL Server) Keywords: database, sql
I need to produce a report with cummulative stats each each month & year in the database.
The data is stored as follows:
11/05/2007 Dave FXR1200
11/05/2007 Frank FXR1200
10/31/2007 Tom Fatboy
10/30/2007 Dave Fatboy
10/30/2007 Paul TZ250
I need to produce a report that shows:
November 2007 2
October 2007 3
My SQL is poor (hence my post). The only query I can come up with is the one below that produces yearly stats.
SELECT year(logdate) as LogMonth, COUNT(id) AS Prospects
FROM calllogs
GROUP BY year(logdate)
order by year(logdate) asc
Can anyone suggest the approach I need to produce the correct stats ?
Source: http://community.livejournal.com/sqlserver/64541.html