I like lemonade.

mysql update replace

You sometimes run into the problem that you want to replace a substring occurring in a column with a different string, without touching the rest of the string. The solution is surprisingly simple, thanks to MySQL


UPDATE table SET field=(REPLACE (field, 'search text', 'replace text'));

using the string function REPLACE, all items in the field column with 'search text' get this substring replaced by 'replace text'. Ideal when writing a script is just too much effort.

quoted (and modified) from: dev.mysql.com

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <code>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.