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?

3

2 Answers 2

0

Use the REPLACE() function.

UPDATE table SET post_content = REPLACE(post_content, 'String: [css3_grid id=''gcse'']', '');
1
  • 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 4, 2015 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 )
2
  • 1
    I think you have the orders of the parameters wrong.
    – neuhaus
    Feb 4, 2015 at 14:16
  • it is highly likely that I do. that's why I would use the google first before actually doing it. ;)
    – Rob
    Feb 4, 2015 at 14:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.