1
這個MySQL語句爲我提供了id_player = 30的所有id_duel_player,它工作正常。MySQL在更新語句中選擇
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
我想爲UPDATE(從duel_player表中的字段)的MySQL聲明這一切id_duel_player返回該select語句。
UPDATE duel_player
SET num = 2,
total = 5
WHERE (duel_player.id_duel_player = id_duel_player's from above SELECT statement)
我想要最有效和最快速的方式來做到這一點。
感謝
您希望從SELECT中獲得多少行? – Joni
@Joni通常小於100,但在某些情況下可能更多(200-400) – Jovan