💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1、根据字段`a, b`分组,然后取组中最新的日期`t_date`的一条,在pg、hivesql中支持以下写法: ```sql select * from ( select *, row_number() over (partition by a, b order by t_date desc) rn from table ) t where rn=1 ``` <br/> <br/> <br/> > ### HiveSQL * 创建分区表 ```sql create table testtable( aid String, name String, orgname String ) partitioned by( p_date String ) ``` * 插入数据 `insert overwrite table testtable partition(p_date) values('1', 'lucy', '20190515')` * 删除分区 `alter table testtable drop partition (p_date='20190515')` * 清空表 `truncate table testtable`