34,587
社区成员
发帖
与我相关
我的任务
分享
;with aaa as
(select row_number() over(partition by type order by id) as row,* from table)
select * from aaa where row<=10
select *
from tb t
where id>=any (select top 10 id from tb where type = t.type order by id desc)
select *
from tb t
where id in (select top 10 id from tb where type = t.type order by id desc)