1

我正在尝试将一些数据库信息从旧数据库附加到新数据库。以下是我正在使用的代码,但是我收到以下错误并且不知道为什么。

UPDATE specs s, cross_ref c 
SET s.cross_ref = CONCAT_WS(',', 's.cross_ref', 'c.comp_num) 
WHERE s.part_num = c.part_num

错误:

"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 ''c.comp_num) 
WHERE s.part_num = c.part_num' at line 1"
4

1 回答 1

1

您的单引号在错误的位置 - 您不需要包装列名。

UPDATE specs s, cross_ref c 
SET s.cross_ref = CONCAT_WS(',', s.cross_ref, c.comp_num) 
WHERE s.part_num = c.part_num
于 2012-11-05T16:00:28.983 回答