所以我试图运行这个sql:
UPDATE creature_template
SET
subname = "Utgarde Keep Heroics",
Health_mod = Health_mod * 45,
mindmg = mindmg * 100,
maxdmg = maxdmg * 100,
Armor_mod = armor_mod * 4
WHERE entry IN (
SELECT difficulty_entry_1
FROM creature_template
WHERE entry IN (
SELECT id FROM creature WHERE map = 574
)
);
但是我收到了这个错误:
[Err] 1093 - 您无法在FROM子句中为更新指定目标表'creature_template'
我该怎么办呢?
答案 0 :(得分:0)
您无法更新在MySQL中的SELECT部分中使用的同一个表。您需要使用如下所示的子查询在嵌套子查询中创建临时表,它不会计入您要更新的同一个表:
UPDATE creature_template
SET
subname = "Utgarde Keep Heroics",
Health_mod = Health_mod * 45,
mindmg = mindmg * 100,
maxdmg = maxdmg * 100,
Armor_mod = armor_mod * 4
WHERE entry IN (
SELECT difficulty_entry_1
FROM (creature_template
WHERE entry IN (
SELECT id
FROM creature ) as temp
WHERE map = 574
)
);
上的MySQL文档
希望这有帮助
答案 1 :(得分:0)