필드 내용에서 특정문자열을 기준으로 문자열 자르기 정보
MySQL 필드 내용에서 특정문자열을 기준으로 문자열 자르기
관련링크
본문
SUBSTRING_INDEX(
str
,delim
,count
)Returns the substring from string
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2); -> 'www.mysql' mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2); -> 'mysql.com'str
beforecount
occurrences of the delimiterdelim
. Ifcount
is positive, everything to the left of the final delimiter (counting from the left) is returned. Ifcount
is negative, everything to the right of the final delimiter (counting from the right) is returned.SUBSTRING_INDEX()
performs a case-sensitive match when searching fordelim
.This function is multibyte safe.
이렇게 좋은 기능이 있는지 처음 알았네요.
특정 필드를 전체 업데이트 하거나 할때 매우 유용하겠어요.
추천
0
0
댓글 0개