Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - Database Management and Reference » UltraLite SQL Elements Reference » Expressions in UltraLite

CASE expressions Next Page

Aggregate expressions


Performs an aggregate computation that the UltraLite runtime does not provide.

Syntax

SUM( expression )

Remarks

An aggregate expression calculates a single value from a range of rows.

An aggregate expression is one in which either an aggregate function is used, or in which one or more of the operands is an aggregate expression.

When a SELECT statement does not have a GROUP BY clause, the expressions in the select-list must be either all aggregate expressions or none of the expressions can be an aggregate expression. When a SELECT statement does have a GROUP BY clause, any non-aggregate expression in the select-list must appear in the GROUP BY list.

Example

For example, the following query computes the total payroll for employees in the employee table. In this query, SUM( salary ) is an aggregate expression:

SELECT SUM( salary )
FROM employee