MySQL: GROUP BY on DATETIME field
Posted by Em on 18 May, 2008
4 Comments
This item was filled under [ MySQL ]
Often webmasters want to sort out data on the basis of Dates when timestamp is stored as datetime in MySQL. To obtain the desired result, simply query:
SELECT DATE_FORMAT(MyDate, '%d %M %Y') AS Date, COUNT(*) AS numRows FROM Table1 GROUP BY Date;
Popularity: 158 views
4 Comments on “MySQL: GROUP BY on DATETIME field”
coool.. learned somethng new today
thanks
awesome!!! exactly what I needed…
A big thank to you!
Very helpful thank you.