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

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Queries and data modification » Summarizing, grouping, and sorting query results » Aggregate functions that summarize query results

 

Where you can use aggregate functions

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.

 See also