mysql, pivot

카테고리 없음 2021. 11. 2. 18:21

WITH RECURSIVE 
unwound AS (
SELECT CONCAT(1,',',2,',',3) AS colors
    UNION ALL
    SELECT regexp_replace(colors, '^[^,]*,', '') colors
      FROM unwound
      WHERE colors LIKE '%,%'
  )
  SELECT regexp_replace(colors, ',.*', '') colors
    FROM unwound

(https://stackoverflow.com/questions/17308669/what-is-the-opposite-of-group-concat-in-mysql)