The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Count() Used in SELECT Clause

Use Count() in a SELECT clause to see how many records are returned with your query.

You can see how many records a query can return by using Count() in the SELECT clause of a query. You can also use Count() to determine the number of rows returned by a query.

Query:

Response:

Query:

Response:

You can use Count(ContactId) to determine how many records are available for certain field values in the DatacloudContact object. GROUP BY is supported for these fields only.

  • companyName
  • Department
  • Level
  • Title

There are some limitations when using GROUP BY with the DatacloudContact object.

  • DatacloudContact doesn’t support grouping multiple fields. Run separate queries for each field.
  • DatacloudContact doesn’t support the rollup or cube operators for GROUP BY.

Query:

Response:

Returned records 1–5 of 10916 total records in 0.105 seconds:

LevelUnknown_Field__1
1Staff501
2Manager-Level480
3Director-Level69
4VP-Level24
5C-Level16