且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL COUNT()多列

更新时间:2023-02-02 22:50:37

您需要取消转移数据:

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


$ b b

我不知道如何确定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.