Forum Moderators: open
I'm trying to count all the records for a specific month in a table which regdate is timestamp instead of datetime.
The table is phpbb table phpbb_users (user_id, regdate,...).
I need to count all users registered in the specific month (i.e. February 2009, January 2006,... etc).
Thank you
SELECT count(user_id) as Counter, DATE_FORMAT(regdate,"%M %Y") as DateRegistered FROM table_name GROUP BY DateRegistered
To show a count of all the records for April 2009 for instance you can use:
SELECT Count(*) FROM table_name WHERE DATE_FORMAT(regdate,"%M %Y") = "April 2009"
Try that