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-09-20 17:33:38 +08:00
select tab.username,count (tab.hwid ) from (select username,hwid from test group by hwid ) tab group by tab.username;
cxbig
2015-09-20 17:40:33 +08:00
没有楼上没那么复杂吧 SELECT username, count (hwid ) FROM table GROUP BY username