SELECT TIME,`type`,COUNT(*) FROM TestGroupBy GROUP BY `type` ORDER BY TIME DESC ,COUNT(*) DESC ;
分页还得排序,你小心你的性能。 思路,计算求和 排序,生成行号翻页。 select * from table1 inner join
(select type ,count(*) as c1 from table1 group by type ) as table2
on table1.type = table2.type order by c1 desc ,time desc
limit 0,10
你看看这个行不 我没有进行测试。
页:
[1]