hive row_number 去重 取第一條

假如根據id去重,取第一條數據,對應當前hive 語句爲:

select t.id, t.name, t.time_c
  from (
        select id,
               name,
               time_c,
               row_number() over(partition by id order by time_c desc) rank
          from table_name
       ) t
 where t.rank = 1

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章