MySQL ORDER BY date and team

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-04-12T07:05:40Z Indexed on 2010/04/12 7:13 UTC
Read the original article Hit count: 373

Filed under:
|

I would like to order by date and then team in a MySQL query. It should be something similar to this:

SELECT * FROM games ORDER BY gamedate ASC, team_id

AND it should output something like this:

2010-04-12 10:20 Game 1 Team 1
2010-04-12 11:00 Game 3 Team 1
2010-04-12 10:30 Game 2 Team 2
2010-04-14 10:00 Game 4 Team 1

So that Team 1 is under each other on the same date, but separate on a new date

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql