hive sql find the latest record

后端 未结 8 2012
别那么骄傲
别那么骄傲 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:23

    You can get the required result without using left outer join like this:

    select * from test where (id, modified) in(select id, max(modified) from test group by id)

    http://sqlfiddle.com/#!2/bfbd5/42

提交回复
热议问题