Syntax
FIELD(str,str1,str2,str3,...)
Purpose
Returns the index position of the parameter str in the list of str1, str2, str3,... (starting from 1). If str is not found, the value is 0.
If all parameters for FIELD() are strings, they are compared as strings. If all parameters are numbers, they are compared as numbers. Otherwise, all parameters are compared as DOUBLE values.
If str is NULL, the value is 0 because NULL cannot be compared to 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
