1. 伪SQL

  • partition by 分组

  • order by 排序

-- > 累计

select 
	str_1, 
	str_2,
	sum(str_2) over( partition by str_1 
					 order by str_1) 
from table

2. 数据示例

str_1

str_2

sum

2024-06-20

10

10

2024-06-21

5

20

2024-06-21

15

20

2024-06-22

21

21