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
NULL
s, the result isNULL
. -
ALL
is the default option — all values in the set that are notNULL
are processed.IfDISTINCT
is specified, duplicates are removed from the set and theSUM
evaluation is done afterwards.
The result type of SUM
depends on the input type:
|
|
|
|
|
|
|
|
|
|
|
|