MySQL 데이터베이스에서 문자열의 일부를 변경하도록 컬럼 값 업데이트하는 방법
2018. 3. 16. 20:45
예를 들어, 특정 테이블 내의 url 값이 http://domain1.com/images/img1.jpg인 것을 http://domain2.com/otherfolder/img1.jpg처럼 변경하고 싶은 경우가 있을 수 있습니다. 이 경우에 다음과 같은 MySQL 쿼리를 사용할 수 있습니다. UPDATE yourtable SET url = REPLACE(url, 'http://domain1.com/images/', 'http://domain2.com/otherfolder/') WHERE url LIKE ('http://domain1.com/images/%'); 관련 문서: https://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_repl..
더 보기...
최근댓글