MySQL select using datetime, group by date only

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-04-22T16:51:15Z Indexed on 2010/04/22 16:53 UTC
Read the original article Hit count: 496

Is is possible to select a datetime field from a MySQL table and group by the date only?

I'm trying to output a list of events that happen at multiple times, grouped by the date it happened on.

My table/data looks like this: (the timestamp is a datetime field)

1. 2010-03-21 18:00:00  Event1
2. 2010-03-21 18:30:00  Event2
3. 2010-03-30 13:00:00  Event3
4. 2010-03-30 14:00:00  Event4

I want to output something like this:

March 21st
1800 - Event 1
1830 - Event 2

March 30th
1300 - Event 3
1400 - Event 4

Thanks!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about mysql-select