这个 MySQL 语句为我提供了 id_player=30 的所有 id_duel_player 并且它工作正常。
SELECT b.id_duel_player
FROM duels a
INNER JOIN duel_player b
ON a.id_duel = b.id_duel
WHERE id_player = 30
UNION ALL
SELECT c.id_duel_player
FROM duel_player c
INNER JOIN
(
SELECT aa.*
FROM duels aa
INNER JOIN duel_player bb
ON aa.id_duel = bb.id_duel
WHERE bb.id_player = 30
) d ON c.id_duel = d.id_duel AND c.id_player <> 30
我想为所有返回此选择语句的 id_duel_player 的 UPDATE(duel_player 表中的字段)创建 MySQL 语句。
UPDATE duel_player
SET num = 2,
total = 5
WHERE (duel_player.id_duel_player = id_duel_player's from above SELECT statement)
我想要最有效和最快的方法来做到这一点。
谢谢