通过over()函数,对数据分组加序号,最后再进行筛选去重。
select row_number() over(partition by a.分组列 order by a.排序列) rn,a.* from table_name a;