« Warm fuzzy feeling of being well-connected | Main | Bangkok Film Festival - selections »

Search and replace in MySQL

For my future reference, searching and replacing some text in MySQL, via SQL.

Info from an article at The Media Tank.

UPDATE mt_entry 
	SET entry_text = REPLACE (entry_text, 'classlink', 'class') 
	WHERE entry_text LIKE '%classlink%' 
	AND entry_id="252";

Dunno why MySQL online manual gives a very basic example which is actually quite non-intuitive for figuring out solutions for "real-life" situations.

Comments

test (to rebuild my blog)

yeah thanks for your pointer, the manual's sample uses a select and is quite unuseful.. btw who'd want to replace "www" with "WwWwWw"???