hive null值排序

tech2023-08-13  102

create table udl.zgc_0903_test ( name string, money string, update_time string ); insert into table udl.zgc_0903_test values ('AAA','200','2020-01-01 12:00:00') ,('AAA','260','2020-02-01 12:00:00') ,('BBB','100','2020-01-01 12:00:00') ,('BBB',NULL,'2020-02-01 12:00:00') ,('BBB',NULL,NULL) ,('CCC','300',NULL) ,('CCC','400',NULL) ,('DDD','100',NULL) ,('DDD','250','2020-02-01 12:00:00'); ,(NULL,'260','2020-02-01 12:00:00') ,(NULL,'100','2020-01-01 12:00:00');

查询 :

select *,row_number()over(partition by name order by update_time desc) rn from udl.zgc_0903_test;

结论:null值排序会排到最后

最新回复(0)