ORACLE:查询各组最新的一条记录

 

有两种写法:
写法一:over partition by 分析函数
SELECT * FROM (select eb_vipcode,eb_time,MAX(eb_time) over(partition by eb_vipcode)
as "atime" from eb_daskexpdateinfo) x where eb_time = "atime";


写法二:group by
SELECT eb_vipcode,MAX(eb_time) AS "atime" FROM eb_daskexpdateinfo group by eb_vipcode

posted @ 2020-09-24 11:14  会飞的小鲸鱼  阅读(908)  评论(0编辑  收藏  举报