Chcę uzyskać:
DATA1
mecz1
mecz2
DATA2
mecz3
...
Stworzyłem zapytanie:
SELECT `games`.`id` AS g_id, `teams`.`name` AS t_name, `games`.`game_date` AS gs_date, (SELECT `teams`.`name` FROM `teams` WHERE `teams`.`id` = `games`.`host_id`) AS hostname, (SELECT `teams`.`name` FROM `teams` WHERE `teams`.`id` = `games`.`guest_id`) AS guestname FROM `teams`, `games` GROUP BY `games`.`id` ORDER BY `games`.`game_date`, `games`.`id`
ale zwraca mi to:
DATA1
mecz1
DATA1
mecz2
DATA2
mecz3
a
GROUP BY `games`.`game_date` ORDER BY `games`.`id`
DATA1
mecz1
DATA2
mecz3
Co robię źle?
Kod PHP:
http://wklej.org/id/294641/