SELECT datediff(now(),datestamp) AS days_ago, count(datediff(now(),datestamp) ) AS count_days FROM userlog group by days_ago