结果去重

1.distinct
select distinct(university) from user_profile;
2.group by
select university from user_profile group by university;
3.row_number() over (parttion by 分组列 order by 排序列)
先根据重复列进行分组,分组后再进行排序【over详情见开窗函数】

select *from
  (
  --查询出重复行
  select *,row_number() over (partition by UserResult order by UserResult desc)num from Table1
  )A
  where A.num=1
posted @ 2024-10-30 11:13  kiss_sheep  阅读(11)  评论(0)    收藏  举报