diff --git a/docs/t-sql/functions/sum-transact-sql.md b/docs/t-sql/functions/sum-transact-sql.md index 3aa46bdf7f7..16b067c5a47 100644 --- a/docs/t-sql/functions/sum-transact-sql.md +++ b/docs/t-sql/functions/sum-transact-sql.md @@ -41,7 +41,7 @@ Returns the sum of all the values, or only the `DISTINCT` values, in the express SUM ( [ ALL | DISTINCT ] expression ) -- Analytic Function Syntax -SUM ( [ ALL ] expression) OVER ( [ partition_by_clause ] [ order_by_clause ] ) +SUM ( [ ALL ] expression) OVER ( [ partition_by_clause ] [ order_by_clause ] [row_or_range_clause] ) ``` ## Arguments @@ -58,11 +58,15 @@ Specifies that `SUM` returns the sum of unique values. A constant, column, or function, and any combination of arithmetic, bitwise, and string operators. *expression* is an expression of the exact numeric or approximate numeric data type category, except for the **bit** data type. Aggregate functions and subqueries aren't permitted. For more information, see [Expressions](../language-elements/expressions-transact-sql.md). -#### OVER ( [ *partition_by_clause* ] [ *order_by_clause* ] ) +#### OVER ( [ *partition_by_clause* ] [ *order_by_clause* ] [ *row_or_range_clause* ] ) *partition_by_clause* divides the result set produced by the `FROM` clause into partitions to which the function is applied. If not specified, the function treats all rows of the query result set as a single group. -*order_by_clause* determines the logical order in which the operation is performed. For more information, see [SELECT - OVER clause](../queries/select-over-clause-transact-sql.md). +*order_by_clause* determines the logical order in which the operation is performed. + +*row_or_range_clause* defines the window frame in which the function is applied. It requires *order_by_clause* to be specified. If *order_by_clause* is specified and *row_or_range_clause* isn't, *row_or_range_clause* assumes its default value `RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW`. + +For more information, see [SELECT - OVER clause](../queries/select-over-clause-transact-sql.md). ## Return types