MySQL FIND_IN_SET() Function
Definition and Usage
The FIND_IN_SET() function returns the position of a string in a comma-separated string list.
Syntax
FIND_IN_SET(string, string_list)
Parameter Values
Parameter | Description |
---|---|
string | Required. The string to find |
string_list | Required. The list of string values to be searched (separated by commas) |
Note
- If string is not found in string_list, FIND_IN_SET() will return 0
- If string or string_list is NULL, FIND_IN_SET() will return NULL
- If string_list is an empty string, FIND_IN_SET() will return 0
Technical Details
Works in: | MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23 |
---|
More Examples
Example
Search for "m" in string list (string list is NULL):
SELECT FIND_IN_SET("m", null);
Try it Yourself »