目标是在两个相似的表中搜索单行数据。
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'...
周末我做了很多谷歌搜索,但找不到解决方案。希望这里有人知道发生了什么。