diff --git a/docs/zh/sql-reference/aggregate-functions/reference/deltasum.md b/docs/zh/sql-reference/aggregate-functions/reference/deltasum.md index 3f099944cee..eabb13376b1 100644 --- a/docs/zh/sql-reference/aggregate-functions/reference/deltasum.md +++ b/docs/zh/sql-reference/aggregate-functions/reference/deltasum.md @@ -4,20 +4,66 @@ toc_priority: 141 # deltaSum {#agg_functions-deltasum} +计算连续行之间的差值和。如果差值为负,则忽略。 + **语法** ``` sql deltaSum(value) ``` -计算连续行之间的差值和。如果差值为负,则忽略。 -`value`必须是整型或浮点类型。 +**参数** -示例: +- `value` — 必须是 [整型](../../data-types/int-uint.md) 或者 [浮点型](../../data-types/float.md) 。 -```sql -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 +**返回值** + +- `Integer` or `Float` 型的算术差值和。 + +**示例** + +查询: + +``` sql +SELECT deltaSum(arrayJoin([1, 2, 3])); ``` +结果: + +``` text +┌─deltaSum(arrayJoin([1, 2, 3]))─┐ +│ 2 │ +└────────────────────────────────┘ +``` + +查询: + +``` sql +SELECT deltaSum(arrayJoin([1, 2, 3, 0, 3, 4, 2, 3])); +``` + +结果: + +``` text +┌─deltaSum(arrayJoin([1, 2, 3, 0, 3, 4, 2, 3]))─┐ +│ 7 │ +└───────────────────────────────────────────────┘ +``` + +查询: + +``` sql +SELECT deltaSum(arrayJoin([2.25, 3, 4.5])); +``` + +结果: + +``` text +┌─deltaSum(arrayJoin([2.25, 3, 4.5]))─┐ +│ 2.25 │ +└─────────────────────────────────────┘ +``` + +## 参见 {#see-also} + +- [runningDifference](../../functions/other-functions.md#other_functions-runningdifference)