mmsql 查询每个分类的前3条数据

select * from (select *,row_number() over(partition by PropertyRoofBeamID order by PropertyRoomID desc) as Sequencecount from PropertyRoom
)t1 where Sequencecount<=3

partition by  具有分组的作用row_number排序进行分组。

 

posted @ 2016-11-16 16:33  ☆♂安♀★  阅读(1222)  评论(0编辑  收藏  举报