SingleStore DB

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 object

  • str1, str2, … : list of strings or binary objects

Return Type

Integer

Example
SELECT FIELD('abra', 'cadabra', 'abra', 'abracadabra');
+-------------------------------------------------+
| FIELD('abra', 'cadabra', 'abra', 'abracadabra') |
+-------------------------------------------------+
|                                               2 |
+-------------------------------------------------+