Break comma separated into multiple rows in MYSQL
Break comma-separated string/column/parameter into multiple rows in MYSQL. with recursive cs_string as ( select 'a,b,c,d' as items), cs_rowID as ( select 1 as n union select n + 1 from cs_rowID, cs_string where n <= length(items) - length(replace(items, ',', ''))) select distinct substring_index(substring_index(items, ',', n), ',', -1) group_name from cs_rowID, cs_string Output: