2012-09-22 49 views
1

我用这个与"更换\"MySQL的REPLACE不起作用

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

该查询返回0 row(s) affected并没有任何反应。

这个查询有什么错?

回答

4

你需要逃避你的反斜线:

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

反斜杠性格特征是转义字符在MySQL,所以你需要逃避它本身是这样的:

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

使用:

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