多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
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`