SQL

 1.分组前3条数据

select * from (
SELECT a.categoryid,a.infoid from information a where (select count(*) from information b where a.CategoryID =b.categoryid and a.infoid>b.infoid)<3
order by a.categoryid,infoid
) c where c.CategoryID in (28) ;

原文地址:https://www.cnblogs.com/ZhengGuoQing/p/2769747.html