SUM#
Returns the sum of all the values, or only the DISTINCT values, in the expression. SUM can be used with numeric columns only. Null values are ignored.
Syntax#
SUM ( [ ALL | DISTINCT ] expression )
OVER ( [ partition_by_clause ] order_by_clause )
Arguments#
_expression_
Is 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 are not permitted.
Return types#
Returns the summation of all expression values in the most precise expression data type. It could be one of bigint, decimal, money, float or int.
Examples#
SELECT SUM([FloatValue]*[DecimalNullableValue]) AS [Sum] FROM [BasicDataTable]