Maria DB 更新和替换

1 mysql mariadb

运行此命令时我收到错误消息:

UPDATE catalog_product_entity_text
SET value = REPLACE (value, 'xxxxx') 
WHERE value LIKE 'yyyyy'; 
Run Code Online (Sandbox Code Playgroud)

错误: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1

有任何想法吗?

谢谢

小智 9

我用表达式得到了同样的错误:

UPDATE catalog_product_entity_tex
     SET value = REPLACE (value, 'yyyyy', 'xxxxx')
     WHERE value LIKE '%yyyyy%';
Run Code Online (Sandbox Code Playgroud)

解决方案是使用别名:

UPDATE catalog_product_entity_tex c
     SET c.value = REPLACE (c.value, 'yyyyy', 'xxxxx')
     WHERE c.value LIKE '%yyyyy%';
Run Code Online (Sandbox Code Playgroud)