简体   繁体   English

MySQL REPLACE不起作用

[英]MySQL REPLACE doesn't work

I use this to replace \\" with " : 我用它用\\"替换\\" "

UPDATE wp_posts SET post_content = REPLACE (post_content, '\"', '"')

That query returns 0 row(s) affected and nothing happens. 该查询返回0 row(s) affected ,但没有任何反应。

What is wrong this this query? 这个查询有什么问题?

你需要逃避反斜杠:

UPDATE wp_posts SET post_content = REPLACE (post_content, '\\"', '"')

反斜杠字符是MySQL中的转义字符,因此您需要像这样对自身进行转义:

UPDATE wp_posts SET post_content = REPLACE(post_content, '\\"', '"')

采用:

REPLACE(`post_content`, '\\"', '"')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM