B-219 Sec-55 Noida, India
+918010221733

How to use Group By day for a timestamp field in MySql

If you  want to use GROUP BY on a time stamp field to fetch data for each day use the below given query

SELECT DATE(FROM_UNIXTIME(timestamp_field)) AS MyDate,
COUNT(*) AS Count
FROM   users_followed
GROUP BY DATE(FROM_UNIXTIME(timestamp_field))

ORDER BY MyDate

(Visited 115 times, 1 visits today)

Leave a reply

You must be logged in to post a comment.