FIND_IN_SET Function

Description

The FIND_IN_SET function looks for the string str in the string list strlist and returns a position of str if it exists. A string list is a string composed of substrings separated by a comma (,).

If str is not in strlist or strlist is an empty string, 0 is returned. If either argument is NULL, NULL is returned. This function does not work properly if str contains a comma (,).

Syntax

FIND_IN_SET(str, strlist)

Example

SELECT FIND_IN_SET('b','a,b,c,d');

2