目标是为一行数据搜索两个相似的表格。在2个表格中搜索唯一条目,然后更改数据
UPDATE
regusers_test AS rt
INNER JOIN
alt_toon_test AS att
ON
att.`toonname` = rt.`toonname`
SET
rt.`server` = CASE WHEN rt.`username`='$user' AND rt.`server`='$oserver' AND rt.`toonname`='$otoon' THEN '$server' ELSE rt.`server`
att.`server` = CASE WHEN att.`username`='$user' AND att.`server`='$oserver' AND att.`toonname`='$otoon' THEN '$server' ELSE att.`server`
WHERE
(
rt.`username`='$user' AND rt.`server`='$oserver' AND rt.`toonname`='$otoon'
)
OR
(
att.`username`='$user' AND att.`server`='$oserver' AND att.`toonname`='$otoon'
)
但我不断收到:
You have an error in your SQL syntax; check the manual that corresponds to your mySQL server version for the right syntax to use near 'att.'server'=Case When att.'username'='$user'...
我做了很多的谷歌搜索在周末,但没有找到一个解决方案。希望这里有人知道发生了什么。
你需要你想设置的两个字段之间用逗号? – andrewsi
回应您的查询。我相信这些错误会很明显。 – Strawberry