我正在将genres
的电影存储在MySQL 8.0数据库中,其列为JSON类型。我正在尝试从列中的所有数组获取所有唯一值。我已经尝试了很多但没有成功。任何帮助将非常感谢。
My Current Query which is returning all the values but there are duplicates
SELECT JSON_EXTRACT(JSON_ARRAYAGG(`genres`), '$[*][*]') FROM `movie`;
["Biography", "Comedy", "Action", "Drama", "Action", "Comedy", "Comedy", "Drama", "Mystery", "Action", "Adventure", "Animation", "Comedy", "Family", "Fantasy", "Sci-Fi", "Action", "Crime", "History", "Thriller", "Comedy", "Drama", "Romance", "Action", "C...
Data View
+--------------------------------------------+
| genres |
+--------------------------------------------+
| ["Biography", "Comedy"] |
| ["Action", "Drama"] |
| ["Action", "Comedy"] |
| ["Comedy", "Drama", "Mystery"] |
| ["Action", "Adventure", "Animation"] |
| ["Action", "Crime", "History", "Thriller"] |
| ["Comedy", "Drama", "Romance"] |
| ... |
| ... |
| ... |
+--------------------------------------------+