row_number()over(partiton by order by ) rank() over(partition by order by )

select * from (select a.* row_number() over(partition by a.task_type,to_char(a.oper_time,'yyyymmdd') order by a.oper_time desc) rank from test a ) t where t.rank=1 不存在重复数据;

select * from (select a.* ,rank() over(partition by a.task_type,to_char(a.oper_time,'yyyymmdd') order by a.oper_time desc) rank from test a ) t where t.rank=1 重复数据;

 

posted @ 2020-11-17 14:11  rjm123456  阅读(210)  评论(0编辑  收藏  举报