SUM()
Sum
Depends on the input type
SUM ([ALL | DISTINCT] <expr>)
| Parameter | Description |
|---|---|
expr |
Numeric expression.It may contain a table column, a constant, a variable, an expression, a non-aggregate function or a UDF.Aggregate functions are not allowed as expressions. |
SUM calculates and returns the sum of non-NULL values in the group.
-
If the group is empty or contains only
NULLs, the result isNULL. -
ALLis the default option — all values in the set that are notNULLare processed.IfDISTINCTis specified, duplicates are removed from the set and theSUMevaluation is done afterwards.
The result type of SUM depends on the input type:
|
|
|
|
|
|
|
|
|
|
|
|