find_in_set
此函数返回字符串 str 在字符串列表 strlist 中的位置(从 1 开始计数)。 Strlist 是一个以逗号分隔的字符串。 如果未找到任何 str,则返回 0。 当参数为 NULL 时,结果为 NULL。
语法
INT find_in_set(VARCHAR str, VARCHAR strlist)
示例
MySQL > select find_in_set("b", "a,b,c");
+---------------------------+
| find_in_set('b', 'a,b,c') |
+---------------------------+
| 2 |
+---------------------------+
关键词
FIND_IN_SET,FIND,IN,SET