0

I need a MySQL Statement to delete the following string from the text in the field called post_content

E.g. String: [css3_grid id='gcse'], How can I do it?

Miheretab Alemu
  • 956
  • 2
  • 20
  • 43
Lewison
  • 25
  • 5

2 Answers2

0

Use the REPLACE() function.

UPDATE table SET post_content = REPLACE(post_content, 'String: [css3_grid id=''gcse'']', '');
neuhaus
  • 3,886
  • 1
  • 10
  • 27
  • If it's a huge table it can be nice to also have WHERE post_content like '%String: [css3_grid id=''gcse'']%', to make transaction smother. – jarlh Feb 04 '15 at 14:19
-1

You're going to want to do something like this:

UPDATE table SET post_content = REPLACE( '[css3_grid id=\'gcse\']' , '' , post_content )
Rob
  • 59
  • 2