일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 오라클
- Data and Time Functions
- String Functions and Operators
- String Function and Operators
- 전자정부표준프레임워크
- 티베로
- Date and Time Functions
- Date and Time Function
- SVN
- String Functions and Date Operators
- 전자정부 표준프레임워크
- Tibero
- Oracle
- 윈도우
- HTTP
- Sring Functions and Operators
- 방화벽
- MySQL
- Today
- Total
웹이야기
[MySQL] FIELD() 본문
MySQL 문자열 함수와 연산자
FIELD()
-
FIELD(str, str1, str2, str3, ...)
의 형태
Returns the index (position) of str in the str1, str2, str3, ... list. Returns 0 if str is not found. If all arguments to FIELD() are strings, all arguments are compared as strings. If all arguments are numbers, they are compared as numbers. Otherwise , the arguments are compared as double.
If str is NULL, the return value is 0 because NULL fails equality comparison with any value. FIELD() is the complement of ELT().
mysql> SELECT FIELD('Bb', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff'); +-------------------------------------------+
| FIELD('Bb', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff') |
+-------------------------------------------+
| 2 |
+-------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT FIELD('Gg', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff');
+-------------------------------------------+
| FIELD('Gg', 'Aa', 'Bb', 'Cc', 'Dd', 'Ff') |
+-------------------------------------------+
| 0 |
+-------------------------------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
[MySQL] FORMAT() (0) | 2020.04.13 |
---|---|
[MySQL] FIND_IN_SET() (0) | 2020.04.10 |
[MySQL] EXPORT_SET() (0) | 2020.04.08 |
[MySQL] ELT() (0) | 2020.04.08 |
[MySQL] CONCAT_WS() (0) | 2020.04.08 |