SUM (Azure Cosmos DB)

APPLIES TO: SQL API

This aggregate function returns the sum of the values in the expression.

Syntax

SUM(<numeric_expr>)  

Arguments

numeric_expr
Is a numeric expression.

Return types

Returns a numeric expression.

Examples

The following example returns the sum of propertyA:

SELECT SUM(c.propertyA)
FROM c

Remarks

This system function will benefit from a range index. If any arguments in SUM are string, boolean, or null, the entire aggregate system function will return undefined. If any argument has an undefined value, it will be not impact the SUM calculation.

Next steps