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
    Please look here: stackoverflow.com/questions/4271186/… Commented Feb 4, 2015 at 14:16
  • 1
    It's columns, not fields... Commented Feb 4, 2015 at 14:18
  • You should remove the PHP tag. Commented Feb 4, 2015 at 14:23

2 Answers 2

0

Use the REPLACE() function.

UPDATE table SET post_content = REPLACE(post_content, 'String: [css3_grid id=''gcse'']', '');
Sign up to request clarification or add additional context in comments.

1 Comment

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.
-1

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

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

2 Comments

I think you have the orders of the parameters wrong.
it is highly likely that I do. that's why I would use the google first before actually doing it. ;)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.