34,590
社区成员
发帖
与我相关
我的任务
分享
select *
from tb t
where (select count(*)from tb where types=t.types and cid>t.cid)<3
select *
from tb t
whre (select count(*)from tb where types=t.types and cid>t.cid)<3
SELECT * FROM @a a WHERE cid in(SELECT TOP 3 htrq FROM @a WHERE types=a.types ORDER BY cid)
select * from (select rn=row_number()over(partition by types order by cid),* from tb) t where rn<=n
select * from tb t where cid in(select top n cid from tb where types=t.types order by cid)