Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL - Come dividere i valori in singole stringhe usando la virgola

In MySQL 8+ puoi usare, ad esempio,

SELECT category.ID, category.TITLE, TRIM(jsontable.value) CATEGORY
FROM category
CROSS JOIN JSON_TABLE( CONCAT('["', REPLACE(category.CATEGORY, ',', '","'), '"]'),
                       "$[*]" COLUMNS( value VARCHAR(254) PATH "$" )
                     ) AS jsontable
ORDER BY category.ID, jsontable.value;

violino