以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  sql不能累计  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=177198)

--  作者:lihe60
--  发布时间:2022/5/12 16:19:00
--  sql不能累计
sele/ct 合同序号,金额,sum(金额) over(order by 合同编号) as 累积金额  fr/om g_业务库 order by 合同序号
--  作者:有点蓝
--  发布时间:2022/5/12 16:26:00
--  

sele/ct 合同序号,金额,(select sum(金额) from 
g_业务库 as a where a.合同序号 < b.合同序号) as 累积金额  fr/om g_业务库 as b order by 合同序号