Possible Duplicate:
Listing diary events grouped by days in PHP/MySQL
I’ve got a database which holds live band gigs for my town, each gig is stored as a record in my MySQL database.
I’d like to group by day to see the gigs on my website. But the GROUP BY function will only show 1 record. How can I show all gigs under one date?
My MySQL structure..
ID date content
1 2012-12-02 00:00:00 Gig 1
2 2012-12-02 00:00:00 Gig 2
1 2012-12-03 00:00:00 Gig 1
2 2012-12-03 00:00:00 Gig 2
I’d like to show like this..
-- Sun 02 December 2012 --
Gig 1
Gig 2
-- Mon 03 December 2012 --
Gig 1
Gig 2
Don’t group the results in the database layer, do it in your presentation layer. For example, using PDO: