我需要在 MySQL 中加入 table_1 和 table_2 并比较哪个用户的奖金最多。然后用获胜的用户 id 更新 table_2.winner..
表格1
city user winnings
1 a 99
1 b 0
1 c 50
1 d 2
表 2
city user_1 user_2 winner
1 a b a
1 c d 50
但是,到目前为止,我正在努力弄清楚如何加入表格
SELECT table_1.winnings AS win_a, table_1.winnings AS win_b
FROM table_1, table_2
WHERE table_2.user_1 = table_1.user
AND table_2.user_2 = table_1.user