FIND_IN_SET
Descriptionβ
Returns the position of the first occurrence of str in strlist (counting starts at 1).
strlist is a comma-delimited string. Special cases:
- If not found, returns 0.
- If any parameter is NULL, returns NULL.
Syntaxβ
FIND_IN_SET ( <str> , <strlist> )
Parametersβ
Parameter | Description |
---|---|
<str> | String to be searched |
<strlist> | String to be searched |
Return valueβ
The position of the first occurrence of parameter <str>
in parameter <strlist>
. Special cases:
- If not found, returns 0.
- If any parameter is NULL, returns NULL.
Exampleβ
SELECT FIND_IN_SET("b", "a,b,c")
| find_in_set('b', 'a,b,c') |
+---------------------------+
| 2 |
+---------------------------+