Я сохраняю 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"] |
| ... |
| ... |
| ... |
+--------------------------------------------+