結果去重

kiss_sheep發表於2024-10-30

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

相關文章