WITH RECURSIVE cte AS ( SELECT device_id, SUBSTRING_INDEX (profile, ',', 1) AS part, SUBSTRING(profile, INSTR (profile, ',') + 1) AS remaining_string, 1 AS level FROM user_submit WHERE profile IS NOT ...