View Single Post

  #2 (permalink)  
Old 26-02-2008, 11:33 PM
Briask's Avatar
Briask Briask is offline
Wannabe Geek
 
Join Date: Feb 2008
Location: Dublin
Posts: 128
Nominated 1 Time in 1 Post
TOTW/F/M Award(s): 0
Briask will become famous soon enough
Default

Do you mean you want to display for a particular userid a count of records per month/year?

If so the the following will do it in MySQL, similar constructs will work in Oracle, MS-SQL, Sybase etc. Let me know if this helps?


SELECT
count(*) as rowCount,
monthname(lastModifiedDate) as month,
year(lastModifiedDate) as year
FROM myTableName
WHERE userid = myUserid
GROUP by year(lastModifiedMate), monthname(lastModifiedDate)
ORDER BY year(lastModifiedDate), monthname(lastModifiedMate)
Reply With Quote