FIND_IN_SET()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
Returns the position of a string in a set of comma-separated substrings.
USAGE
FIND_IN_SET(find, set)
DETAILS
FIND_IN_SET()
is a string function that searches for the first argument in a set (provided as a delimited string in the second argument) and returns a 1-based index of the result.
The return value is 0
if the find string is not found or if the list string is empty.
All comparisons are string versus string, with any non-string arguments being first converted into a string.
A NULL
is returned if either of the arguments is NULL
.
PARAMETERS
| The string value expression to find. |
| A single string that contains a comma-separated list of text value list. |
EXAMPLES
SELECT FIND_IN_SET('a', 'm,a,r,i,a,d,b');
+-----------------------------------+
| FIND_IN_SET('a', 'm,a,r,i,a,d,b') |
+-----------------------------------+
| 2 |
+-----------------------------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.