对不起,如果我第一次使用stackoverflow时做错了什么,对不起大家,浪费我的时间。我与一些用户交谈,我可以做一些不同的事情。 在此之后的默认值(今天从-60到-365)将有另一列称为损失的列,以获取其余值。
感谢所有帮助我的人!问题解决了!
CASE
WHEN TO_DATE(SYSDATE,'DD/MM/YY')-425 <= TO_DATE(TRIM(DT_TRANSACAO),'DD/MM/YY')
THEN SUM(VL_VENCIDO)
ELSE 0
END AS VL_VENCIDO, ---defaults(today -60 until -365 days ago)
CASE
WHEN TO_DATE(SYSDATE,'DD/MM/YY')-425 > TO_DATE(TRIM(DT_TRANSACAO),'DD/MM/YY')
THEN SUM(VL_VENCIDO)
ELSE 0
END AS VL_PDD, --loss more than 425 days ago
---acumulated loss and defaults
sum(VL_PDD) over (order by YEAR, MONTH) AS VL_AC_PDD,
sum(VL_VENCIDO) over (order by YEAR, MONTH) AS VL_AC_INADI
谢谢大家!再次抱歉,英语不是我的最佳技能!
答案 0 :(得分:0)
CASE
WHEN TO_DATE(SYSDATE,'DD/MM/YY')-425 <= TO_DATE(TRIM(DT_TRANSACAO),'DD/MM/YY')
THEN SUM(VL_VENCIDO)
ELSE 0
END AS VL_VENCIDO, ---defaults(today -60 until -365 days ago)
CASE
WHEN TO_DATE(SYSDATE,'DD/MM/YY')-425 > TO_DATE(TRIM(DT_TRANSACAO),'DD/MM/YY')
THEN SUM(VL_VENCIDO)
ELSE 0
END AS VL_PDD, --loss more than 425 days ago
---acumulated loss and defaults
sum(VL_PDD) over (order by YEAR, MONTH) AS VL_AC_PDD,
sum(VL_VENCIDO) over (order by YEAR, MONTH) AS VL_AC_INADI