我有两张桌子。
player1 有行 username, score, game_id, ...
player2 有行 username, score, game_id...
你如何为同一个 game_id 选择得分最高的用户名?
我所拥有的是
SELECT player1.username winning,
player1.points,
player1.game_id
FROM player1
INNER JOIN player2 ON player1.game_id = player2.game_id
WHERE player1.points > player2.points
和
SELECT player2.username winning,
player2.points,
player2.game_id
FROM player1
INNER JOIN player2 ON player1.game_id = player2.game_id
WHERE player2.points > player1.points