标签: mysql sql
找到最多发生的值的正确SQL(MYSQL)是什么?
以下是我的想法:
SELECT TOP 1 `my_field` FROM `my_table` GROUP BY COUNT(`my_field`) ORDER BY DESC
答案 0 :(得分:2)
获得最常见的值:
SELECT `column` FROM `table` GROUP BY `column` ORDER BY count(`column`) DESC LIMIT 1