hive sql find the latest record

后端 未结 8 1991
别那么骄傲
别那么骄傲 2021-01-30 17:28

the table is:

create table test (
id string,
name string,
age string,
modified string)

data like this:

id    name   age  modife         


        
8条回答
  •  一生所求
    2021-01-30 18:15

    If u can make sure that row which has max modified also has max age in same id row set.

    Try

    select id, name, max(age), max(modified) 
    from test
    group by id, name
    

提交回复
热议问题