일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
- 비전공 개발자
- 비전공자
- MAC
- html5
- css3
- effect
- hover
- SWIFT
- jQuery
- php
- xcode
- CSS
- HTML
- 프론트엔드
- ipad
- image
- 자바스크립트
- keyframes
- IOS
- 개발자
- Animation
- 애니메이션
- iOS 개발자
- 풀스택
- iPhone
- react
- button
- front-end
- javascript
- 백엔드
- Today
- Total
비전공자 개발일기
FIND_IN_SET() 본문
FIND_IN_SET() in MySQL
- Syntax: FIND_IN_SET(search string, string list)
- Example: FIND_IN_SET('ank', 'b,ank,of,monk')
$datas = "";
foreach ($data_info as $key => $value) {
$datas .= $value . ",";
}
- Example2:
SELECT * FROM client_contract WHERE FIND_IN_SET(idx,'{$datas}')-> client_contract 테이블에서 {$datas}라는 필드값에서 idx인 데이터만을 반환
- Result: 2
-> 특정 세트(ex 배열) 내에 있는 걸 찾는다는 의미로, 해당 string의 위치를 반환
-> 검색한 문자의 값이 없을 경우, 0을 반환
https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_find-in-set
MySQL :: MySQL 5.7 Reference Manual :: 12.8 String Functions and Operators
12.8 String Functions and Operators Table 12.12 String Functions and Operators Name Description ASCII() Return numeric value of left-most character BIN() Return a string containing binary representation of a number BIT_LENGTH() Return length of argument
dev.mysql.com
https://www.w3resource.com/mysql/string-functions/mysql-find_in_set-function.php
MySQL FIND_IN_SET() function - w3resource
MySQL FIND_IN_SET() returns the position of a string if it is present (as a substring) within a list of strings.
www.w3resource.com