select * from (select * from (select *,row_number() over (partition by author order by tips) rank from tb) t where rank<=100) T having count(T.author)<=5
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
SQL code
Select Top 100 * from Articles A Where Id in
(select Top 5 id from Articles Where author = A.author Order by tips desc)
Order By tips desc
------解决方案-------------------- 我看到4楼,觉得改一个order就对,于是看到了6楼,非常好的利用了sql新特性,再下边就没看下去,抱歉,6楼的应该正确,row_number效率我试过100万记录飞快