Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用于从记录中删除字符串的MySQL SQL查询_Mysql_Sql - Fatal编程技术网

用于从记录中删除字符串的MySQL SQL查询

用于从记录中删除字符串的MySQL SQL查询,mysql,sql,Mysql,Sql,我需要一个MySQL语句从名为post_content的字段中的文本中删除以下字符串 例如String:[css3\u grid='gcse'],我该怎么做?您将要执行以下操作: UPDATE table SET post_content = REPLACE( '[css3_grid id=\'gcse\']' , '' , post_content ) 使用该函数 UPDATE table SET post_content = REPLACE(post_content, 'String: [

我需要一个MySQL语句从名为post_content的字段中的文本中删除以下字符串


例如String:[css3\u grid='gcse'],我该怎么做?

您将要执行以下操作:

UPDATE table SET post_content = REPLACE( '[css3_grid id=\'gcse\']' , '' , post_content )
使用该函数

UPDATE table SET post_content = REPLACE(post_content, 'String: [css3_grid id=''gcse'']', '');

请看这里:这是列,而不是字段…你应该删除PHP标记。我认为你的参数顺序是错误的。我很可能是这样做的。这就是为什么我会在实际操作之前先使用谷歌;如果它是一个巨大的表,那么最好还有WHERE post_内容,如“%String:[css3_grid=gcse]%”,以使事务窒息。