Group by day from timestamp
How about this? Using the DATE
function:
SELECT DATE(FROM_UNIXTIME(MyTimestamp)) AS ForDate,
COUNT(*) AS NumPosts
FROM MyPostsTable
GROUP BY DATE(FROM_UNIXTIME(MyTimestamp))
ORDER BY ForDate
This will show you the number of posts on each date that the table has data for.
SELECT DATE(timestamp) AS ForDate,
COUNT(*) AS NumPosts
FROM user_messages
GROUP BY DATE(timestamp)
ORDER BY ForDate
This found for me. I have timestamp like "2013-03-27 15:46:08".