假如你现在的月份列不带"月",表名是dual
用自连接
select
a.月份
,a.总额
,b.总额/a.总额-1
from dual a left join dual b
on a.月份 =b.月份-1
参考环比-https://help.fanruan.com/finereport/doc-view-350.html
sql语句直接参考https://blog.csdn.net/gslzydwgh/article/details/57405898?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
https://jingyan.baidu.com/article/e9fb46e13ce1b67521f76613.html
划个重点。