티스토리 뷰

공부

[MySQL] replace text

seunggabi 승가비 2020. 6. 13. 20:55
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

 

댓글
댓글쓰기 폼