select * from ( select row_number() over(partition by 分组字段 order by 排序字段) as rownum -- 排序并分组 , * -- 所需显示的字段 from 表名 ) as T where T.rownum = 1
select * from ( select row_number() over(partition by 分组字段 order by 排序字段) as rownum -- 排序并分组 , * -- 所需显示的字段 from 表名 ) as T where T.rownum = 1
转载于:https://www.cnblogs.com/ecosu/p/4759657.html