select tmp.username, count (1 ) cnt from (select username, count (1 ) from table_name group by username, hwid ) tmp group by tmp.username order by cnt desc;
ttcool
2015 年 9 月 20 日
select tab.username,count (tab.hwid ) from (select username,hwid from test group by hwid ) tab group by tab.username;
cxbig
2015 年 9 月 20 日
没有楼上没那么复杂吧 SELECT username, count (hwid ) FROM table GROUP BY username