一。select * from(
select ID,ShopClient_ID,Name,Icon,HitCount,Class1_ID,row_number() over(partition by Class1_ID order by HitCount desc)
as rowindex from tab_Goods)a
where rowindex<=5
二。SELECT * FROM tab_Goods a
WHERE (SELECT count(*) FROM tab_Goods b WHERE b.Class1_ID=a.Class1_ID AND b.ID>a.ID)<5
ORDER BY Class1_ID desc