ClickHouse/docs/zh/sql-reference/aggregate-functions/reference/deltasum.md
2021-03-25 17:09:19 +08:00

422 B

toc_priority
141

deltaSum

语法

deltaSum(value)

计算连续行之间的差值和。如果差值为负,则忽略。 value必须是整型或浮点类型。

示例:

select deltaSum(arrayJoin([1, 2, 3]));                  -- => 2
select deltaSum(arrayJoin([1, 2, 3, 0, 3, 4, 2, 3]));   -- => 7
select deltaSum(arrayJoin([2.25, 3, 4.5])); -- => 2.25