这个查询工作得很好,但是如何使用join而不是subquery呢?
SELECT
games.id,
games.team_home,
games.score_home,
games.team_away,
games.score_away,
(SELECT teams.name FROM teams WHERE teams.id=games.team_home ) as t1,
(SELECT teams.name FROM teams WHERE teams.id=games.team_away ) as t2
FROM
games, teams
WHERE
games.date_game = '2018-06-15'
GROUP BY
games.id
1条答案
按热度按时间wi3ka0sx1#
您可以这样做,id上有两个连接: