mysql.h


FIELD()

FIELD(str,str1,str2,str3,...)

Devuelve el índice de 'str' en la lista 'str1', 'str2', 'str3', .... Devuelve o si 'str' no se encunetra. FIELD() es el complemento de ELT():

mysql> SELECT FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo');
+------------------------------------------------+
| FIELD('ej', 'Hej', 'ej', 'Heja', 'hej', 'foo') |
+------------------------------------------------+
|                                              2 |
+------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo');
+------------------------------------------------+
| FIELD('fo', 'Hej', 'ej', 'Heja', 'hej', 'foo') |
+------------------------------------------------+
|                                              0 |
+------------------------------------------------+
1 row in set (0.00 sec)