FIND_IN_SET (str, strlist) if the str string is in the strlist consisting of N sub-chains, the return range is between 1 and N. A string list is a string consisting of several tokens separated by commas. If the first parameter is a constant string and the second parameter is a typeSET column, then
FIND_IN_SET (str, strlist) if the str string is in the strlist consisting of N sub-chains, the return range is between 1 and N. A string list is a string consisting of several tokens separated by commas. If the first parameter is a constant string and the second parameter is the type SET column, then
- FIND_IN_SET (Str,Strlist)
Assume that the string
StrIn
NString list composed of substrings
Strlist, The returned value range is 1
N. A string list is a string consisting of several tokens separated by commas. If the first parameter is a constant string and the second parameter is the type SET column The FIND_IN_SET () function is optimized and bit computing is used. If
StrNo
StrlistOr
StrlistIf it is a null string, the return value is 0. If any parameter is NULL, the return value is NULL. This function cannot run normally when the first parameter contains a comma.
Mysql>SELECT FIND_IN_SET ('B', 'a, B, c, D ');
-> 2
Extended usage, sorted by FIND_IN_set
Eg:
$ Ids = '9 ';
$ SQL = "... WHERE goods_id IN ('{$ ids}') ORDER BY FIND_IN_SET (goods_id, '{$ ids }')";