目录
0 问题描述
1 数据准备
2 问题分析
3 小结
0 问题描述
有如下数据:反应了每月的页面浏览量
现需要按照如下规则计算每月的累计阅读量,具体计算规则如下:
最终结果如下:
1 数据准备
with data as(
select '2024-01' as month ,2 as pv union all
select '2024-02' as month ,5 as pv union all
select '2024-03' as month ,6 as pv union all
select '2024-04' as month ,9 as pv union all
select '2024-05' as month ,60 as pv union all
select '2024-06' as month