FIND_IN_SET() - Mysql String Function

FIND_IN_SET() is used to find string within another string containing comma-separated values.

FIND_IN_SET() function Return the first occurence of the first string within the second string .
This function Returns 0 when search string does not exist in the string, and Returns NULL if either string is NULL.


FIND_IN_SET (string, list)


mysql> SELECT FIND_IN_SET('d','a,b,c,d,e,f,g,h');
        -> 4
mysql> SELECT FIND_IN_SET(NULL,'a,b,c,d,e,f,g,h');
        -> NULL
mysql> SELECT FIND_IN_SET('z','a,b,c,d,e,f,g,h');