1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| with recursive split ( ID, NAME_splited, NAME ) as ( select ID, '', NAME from COMPANY union all select ID, substr(NAME, 1, case instr(NAME, ',') when 0 then length(NAME) + 1 else instr(NAME, ',') end - 1), substr(NAME, case instr(NAME, ',') when 0 then length(NAME) else instr(NAME, ',') end + 1) from split where NAME <> '' ) select ID, NAME_splited from split where NAME_splited <> '' order by ID ;
|