标签:SQL 查询重复次数最多
SELECT t.id,t.name,a.nu FROM t
LEFT JOIN
(SELECT id,NAME,COUNT() AS nu FROM t GROUP BY NAME) a ON t.name=a.name
JOIN
(SELECT id,NAME,COUNT() AS num FROM t GROUP BY NAME ORDER BY num DESC LIMIT 1) c
WHERE a.nu=c.num
有更好的写法求告知。
标签:SQL 查询重复次数最多
原文地址:http://blog.51cto.com/woniu123/2108561