SELECT FROM_UNIXTIME(access, '%Y %M') AS 'Year and Month', count(*)
FROM users GROUP BY FROM_UNIXTIME(access, '%Y %M') WITH ROLLUP;Select all user's access times grouped by year and months with counts.
More info can be had at http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#func...
Thanks owed to Chandima for making me aware of this great function.
Add your comment