COUNT Aggregate Function
The function uses the following syntax:
COUNT([DISTINCT] <Expression>)
This function counts the number of values selected from the field indicated in the parameter. As opposed to other aggregate functions, you can use COUNT in three ways.
- First, this function allows you to count the number of field values, not equal to NULL.
- Secondly, this function allows you to count the number of different field values, not equal to NULL. To do so, you must use the DISTINCT keyword before the field specifications.
- Lastly, the functions can calculate the number of rows in the query result. To do so, you must use an asterisk ("*") as a function parameter.
You can indicate expressions containing values of any type as a function parameter. You cannot use this function with ValueStorage expressions and unlimited length strings.
Example:
SELECT
COUNT (*) AS Total,
COUNT (DISTINCT Invoice.Nomenclature) AS DifferentFROM
Document.ExpInvoice.Content AS Invoice
Query result:
Total
Different
24
8
See also: Aggregate Functions