olxl2021 2023-01-09 21:51 采纳率: 0%
浏览 142
已结题

sql语句,拉链写法。实现目标表如图所示

img


从上面那张表拉链到下面表。怎么得到。用传统关系型oracle sql实现

  • 写回答

10条回答 默认 最新

  • wux_labs 2023-01-09 22:07
    关注
    获得2.40元问题酬金

    写好了吗?代码如下,如果有用,望采纳,谢谢!

    with temp as (select acct_no,current_bal,txn_dt,row_number() over(partition by acct_no order by txn_dt) as rn from t03_acctno_bal)
    select t1.acct_no as acctno,t1.txn_dt as start_dt,nvl(t2.txn_dt,'3000-12-31') as end_dt,t1.current_bal from temp t1 left join temp t2 on t1.acct_no = t2.acct_no and t1.rn+1=t2.rn
    
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 1月17日
  • 赞助了问题酬金15元 1月9日
  • 创建了问题 1月9日

悬赏问题

  • ¥15 python深度学习代码求跑
  • ¥100 对接美团闪购医药接口相关问题
  • ¥15 嵌入式软件电子烟开发
  • ¥15 职场 Excel 查重问题
  • ¥20 multisim方波发生电路产生的波形异常,学校没讲模电就留了实验qwq
  • ¥15 求怎么用idea2021.3.2创建web项目并配置tomcat
  • ¥100 or-tools的相关问题
  • ¥15 有可能用平板通过拓展坞来烧录程序吗(keil5的那种)
  • ¥15 状态图的并发态问题咨询
  • ¥15 PFC3D,plot