Declaration
FIELD(str,str1,str2,str3,...)
Description
Returns the index position of str in the list str1, str2, str3,... (starting from 1). If str is not found, the return value is 0.
If all parameters of FIELD() are strings, they are compared as strings. If all parameters are numbers, they are compared as numbers. Otherwise, the parameters are compared as DOUBLE values.
If str is NULL, the return value is 0, because NULL cannot be equated with any value. FIELD() is the complement of ELT().
Examples
obclient> SELECT FIELD('abc','abc1','abc2','abc','abc4','abc'), FIELD(NULL, 'null1', NULL);
+-----------------------------------------------+----------------------------+
| FIELD('abc','abc1','abc2','abc','abc4','abc') | FIELD(NULL, 'null1', NULL) |
+-----------------------------------------------+----------------------------+
| 3 | 0 |
+-----------------------------------------------+----------------------------+
1 row in set