DT
https://clickhouse.tech/docs/ru/engines/table-engines/mergetree-family/summingmergetree/
Size: a a a
DT
OG
A
OG
OG
group by ((<=) date)
A
DT
OG
OG
A
ДБ
DT
DT
Д
OG
DC
DT
OG
DT
OG
SELECT groupArrayMovingSum(n)
FROM
(
SELECT
date,
sum(n) AS n
FROM
(
SELECT
arrayJoin(['2020-01-01', '2020-01-02']) AS date,
arrayJoin([1, 1]) AS n
)
GROUP BY date
ORDER BY date ASC
)
┌─groupArrayMovingSum(n)─┐
│ [2,4] │
└────────────────────────┘