count top 10 most occuring values in a column in mysql

前端 未结 4 1170
栀梦
栀梦 2020-12-01 15:39

I have a column in mysql table that has the the data type INT(11).

How can I search to get the top 10 most occurring values in this column?

4条回答
  •  时光说笑
    2020-12-01 15:49

    Try:

    SELECT ColName, Count(1) AS occurances
        FROM
            table
        GROUP BY
            ColName
        ORDER BY
            occurances DESC
        LIMIT
            10
    

提交回复
热议问题