更新时间:2023-01-29 16:50:32
您需要对数据进行逆透视:
You need to unpivot the data:
SELECT tag, COUNT(*)
FROM (
SELECT tag_1 AS tag
UNION ALL
SELECT tag_2 AS tag
UNION ALL
SELECT tag_3 AS tag
) AS X (tag)
GROUP BY tag
ORDER BY COUNT(*) DESC
我不确定如何为特定标签确定 flv,因为每个 id 可以有一个 flv 和最多 3 个标签,似乎任何标签都可以有许多不同的 flv.
I'm not sure how the flv is determined for a particular tag, since each id can have a single flv and up to 3 tags, it seems like any tag can have many different flv.