本文转自:【Orcale】分析函数 OVER(PARTITION BY... ORDER BY...)的讲解
项目中用到分组排序,求和之类的,这位小哥写的很详细,记录一下
算当期之后剩余的本金利息和
select rid||'',lid,indexs,should_capital,fact_capital,should_interest,fact_interest,
sum(should_capital) over(partition by lid order by indexs desc) - should_capital as rest_capital,
sum(should_interest) over(partition by lid order by indexs desc) - should_interest as rest_interest
from ods.s02_loan_repayment;


本文深入讲解了Oracle数据库中分析函数OVER(PARTITION BY...ORDER BY...)的使用方法,通过实例展示了如何进行分组排序和求和操作,特别适用于贷款偿还场景下计算剩余本金和利息。
388

被折叠的 条评论
为什么被折叠?



