SET @json = '["a", "b", "b", "a", "c"]';
SELECT Json_arrayagg(dt.val) AS unq_json_array
FROM (SELECT DISTINCT Json_extract(@json, Concat('$[', seq.n, ']')) AS val
FROM (SELECT 0 AS n UNION ALL SELECT 1 UNION ALL
SELECT 2 UNION ALL SELECT 3 UNION ALL
SELECT 4 UNION ALL SELECT 5 UNION ALL
SELECT 6 UNION ALL SELECT 7 UNION ALL
SELECT 8 UNION ALL SELECT 9) AS seq) AS dt
WHERE dt.val IS NOT NULL;
如果有来生,要做一片树叶。
春天恋上枝,炎夏恋上水。
深秋恋上土,东来化作泥。
润物细无声,生生世世恋红尘。