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排序进行分组。