sqlserver分组取top

select s.*  

from ( 

    select *, row_number() over (partition by [分组字段] order by [排序字段]) as 别名  

    from 表名称

) s

where s.别名 = 1

  ..

posted @ 2019-11-10 22:15  salv  阅读(799)  评论(0编辑  收藏  举报