Aggregate functions can be used in a SELECT list or in the HAVING clause of a grouped query block.
You cannot use aggregate functions in a WHERE clause or in a JOIN condition. However, a SELECT query block with aggregate functions in its SELECT list often includes a WHERE clause that restricts the rows to which the aggregate is applied.
Whenever an aggregate function is used in a SELECT query block that does not include a GROUP BY clause, it produces a single value, whether it is operating on all the rows in a table or on a subset of rows defined by a WHERE clause.
You can use more than one aggregate function in the same SELECT list, and produce more than one aggregate in a single SELECT query block.
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|