티스토리 뷰

공부

[MySQL] replace text

승가비 2020. 6. 13. 20:55
728x90
UPDATE table_name SET field = REPLACE(field, 'foo', 'bar') WHERE INSTR(field, 'foo') > 0;

https://stackoverflow.com/questions/125230/mysql-search-and-replace-some-text-in-a-field

 

MySQL search and replace some text in a field

What MySQL query will do a text search and replace in one particular field in a table? I.e. search for foo and replace with bar so a record with a field with the value hello foo becomes hello bar.

stackoverflow.com

 

728x90
댓글