select scrq,rsj,
sum(rsj) over(partition by to_char(scrq,'yyyy-mm') order by scrq) ysj,
sum(rsj) over(order by scrq) as nsj
from tb_test_over
order by scrq;
https://blog.csdn.net/u012324101/article/details/80251003 参考
PS:最好把SQL直接复制粘贴一份贴出来,打起来还是有点麻烦
补充
select dddh,cpph,pcrq,pcsl,sum(pcsl) over(order by pcrq) as 总和
from PMCTABLE where dddh='202112185' order by pcrq