SUM function [Aggregate]

Function

Returns the total of the specified expression for each group of rows.

Syntax

SUMexpression | DISTINCT column-name )

Parameters

expression The object to be summed. This is commonly a column name.

DISTINCT column-name Computes the sum of the unique values in column-name for each group of rows. This is of limited usefulness, but is included for completeness.

Example

The following statement returns the value 3749146.740:

SELECT SUM( salary )
FROM Employees

Usage

Rows where the specified expression is NULL are not included.

Returns NULL for a group containing no rows.

Standards and compatibility

See also

“AVG function [Aggregate]”

“COUNT function [Aggregate]”

Chapter 2, “Using OLAP” in the System Administration Guide: Volume 2