I'm getting error message when run this:
UPDATE catalog_product_entity_text
SET value = REPLACE (value, 'xxxxx')
WHERE value LIKE 'yyyyy';
Error: #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
#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
Any Ideas?
Thanks
I obtained the same error with the expression:
UPDATE catalog_product_entity_tex
SET value = REPLACE (value, 'yyyyy', 'xxxxx')
WHERE value LIKE '%yyyyy%';
The solution was using alias:
UPDATE catalog_product_entity_tex c
SET c.value = REPLACE (c.value, 'yyyyy', 'xxxxx')
WHERE c.value LIKE '%yyyyy%';
replace
is wrong. Here is correct way:
MariaDB [maison]> select replace('aaaaaa', 'a', 'b');
+-----------------------------+
| replace('aaaaaa', 'a', 'b') |
+-----------------------------+
| bbbbbb |
+-----------------------------+
1 row in set (0.01 sec)
Your query must be something like:
UPDATE
catalog_product_entity_text
SET
value = REPLACE (value, 'xxxxx', 'zzzzz')
WHERE
value LIKE 'yyyyy';
Replace takes three arguments, not two. Presumably, you want:
UPDATE catalog_product_entity_tex
SET value = REPLACE (value, 'yyyyy', 'xxxxx')
WHERE value LIKE '%yyyyy%';
Also note the use of wildcards in the LIKE
pattern.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.