我一直收到此错误
#1064 - 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 'FROM `rate` R, `temp` T WHERE R.`rate` > T.`rate` AND `rate`.`prefix` LIKE C'
这是我的查询
UPDATE R
SET R.rate = T.rate,
R.vendor = T.provider,
FROM rate R, temp T
WHERE R.rate > T.rate
AND R.prefix LIKE CONCAT(T.prefix, '%' )
ORDER BY LENGTH( T.prefix ) DESC LIMIT 1;
答案 0 :(得分:1)
您使用的MySQL语法不正确。
UPDATE rate R join
`temp` T
on R.`rate` > T.`rate` AND R.`prefix` LIKE CONCAT(T.`prefix`, '%' )
SET R.`rate` = T.`rate`,
R.`vendor` = T.`provider`
ORDER BY LENGTH( T.`prefix` ) DESC
LIMIT 1;
但是,在第二个set
声明结束时,您的直接问题是额外的逗号。
答案 1 :(得分:0)
尝试:
UPDATE rate r, temp t
SET r.rate = t.rate, r.vendor = t.provider
WHERE r.rate > t.rate
AND r.prefix LIKE CONCAT(t.prefix, '%')