COUNT( )
Go Up to Statement and Function Reference (Language Reference Guide)
Calculates the number of rows that satisfy search condition of a query. Available in gpre, DSQL, and isql.
COUNT ( * | [ALL] value | DISTINCT value)
| Argument | Description |
|---|---|
|
|
Retrieves the number of rows in a specified table, including |
|
|
Counts all non- |
|
|
Returns the number of unique, non- |
|
<val> |
A column or expression. |
Description: COUNT() is an aggregate function that returns the number of rows that satisfy the search condition of a query. It can be used in views and joins, as well as in tables.
Example: The following embedded SQL statement returns the number of unique currency values it encounters in the COUNTRY table:
EXEC SQL SELECT COUNT (DISTINCT CURRENCY) INTO :cnt FROM COUNTRY;