您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Oracle Query: 在列中选择数据的最后更改

Oracle Query: 在列中选择数据的最后更改

一个简单的方法是在select子句中使用子查询

select
  product_id,
  price_date,
  product_price,
  (
    select
      max(before.product_price) keep (dense_rank last order by before.price_date)
    from comp_results before
    where before.product_id = comp_results.product_id
      and before.price_date < comp_results.price_date
      and before.product_price <> comp_results.product_price
  ) as last_price
from comp_results
order by product_id, price_date desc;
Oracle 2022/1/1 18:49:49 有370人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶