查询压岁钱表age_money
select * from age_money;
year1 money 2001 10 2002 20 2003 20 2004 5 2005 10
递归累加
WITH T AS ( select year1,money from age_money where order by year1 ) SELECT T.year1,T.money, SUM(T.money) OVER(ORDER BY T.year1) as Recursion_Accumulate FROM T
year1 money RECURSION_ACCUMULATE 2001 10 10 2002 20 30 2003 20 50 2004 5 55 2005 10 65