Returns the number of records in the resultset/group. When used with the optional DISTINCT keyword, returns the unique number of records in the resultset/group.
This parameter can be either an asterisk (*) or an expression. If an asterisk is used then all rows of the resultset/group are counted regardless of NULL status. If the expression for a row evaluated to NULL, it will not be counted.
Example:
With the sample data set:
Field1 |
Field2 |
Field3 |
---|---|---|
23 |
10 |
17 |
17 |
10 |
9 |
5 |
12 |
15 |
SELECT COUNT(Field2) returns 3. SELECT COUNT(Distinct Field2) returns 2.