一、根据字符串找位置
find_in_set
第二个参数是以逗号隔开的,从第二个参数集合中查找第一个参数的位置
mysql> select find_in_set('mysql','oracle,sql server,mysql,db2');
+----------------------------------------------------+
| find_in_set('mysql','oracle,sql server,mysql,db2') |
+----------------------------------------------------+
| 3 |
+----------------------------------------------------+
1 row in set (0.00 sec)
field
mysql> help field
Name: 'FIELD'
Description:
Syntax:
FIELD(str,str1,str2,str3,...)
Returns the index (position) of str in the str1, str2, str3, ... list.
Returns 0 if str is not found.
If all arguments to FIELD() are strings, all arguments are compared as
strings. If all arguments are numbers, they are compared as numbers.
Otherwise, the arguments are compared as double.
If str is NULL, the return value is 0 because NULL fa