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

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;

猜你喜欢

转载自chensj.iteye.com/blog/2360096