hariprasadraja
10/15/2019 - 6:45 AM

sql select string in SET

Note

  • If string is not found in string_list, the FIND_IN_SET function will return 0.
  • If string is NULL, the FIND_IN_SET function will return NULL.
  • If string_list is an empty string, the FIND_IN_SET function will return 0.
  • If string_list is NULL, the FIND_IN_SET function will return NULL.
SELECT FIND_IN_SET('f', 'a,b,c,d,e,f');
-- Result: 6

-- OR 
SELECT FIND_IN_SET('g', '');
-- Result: 0

SELECT FIND_IN_SET(null, 'a,b,c');
-- Result: NULL