欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

oracle在一张表中,同一个ID 有多条记录,每个ID只获取最新时间的记录 ora分组partition by

程序员文章站 2022-05-17 13:14:00
...
select c.open_id,c.created_date
                           from (select t.*,
                                        row_number() over(partition by t.open_id order by t.created_date desc) rn
                                   from nec_opr.EC_WECHAT_CALL_DATA_BIND t
                                  where t.open_id is not null) c
                          where rn = 1;