FIND_IN_SET()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the position of a string in a set of comma-separated substrings.
USAGE
FIND_IN_SET(find, set)
Argument Name | Description |
---|---|
| The value that is being searched for |
| A single string that contains a comma-separated list of text values |
DETAILS
FIND_IN_SET()
is a string function that searches for the find
argument in the set
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 find
string is empty.
All comparisons are string versus string, with any non-string arguments being first converted into a string.
Character comparisons are case-insensitive.
A NULL
is returned if either of the arguments is NULL
.
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 |
+-----------------------------------+