Outdated Version
You are viewing an older version of this section. View current production version.
FIELD
Returns the first index of the str argument in the str1, str2, … list, or 0 if it doesn’t exist.
Syntax
FIELD (str, str1, str2, ...)
Arguments
str
: any string or binary objectstr1
,str2
, … : list of strings or binary objects
Return Type
Integer
Example
select field('abra', 'cadabra', 'abra', 'abracadabra');
+-------------------------------------------------+
| field('abra', 'cadabra', 'abra', 'abracadabra') |
+-------------------------------------------------+
| 2 |
+-------------------------------------------------+