A read-only SObject that returns query results only if a query call contains an aggregate function, such as MAX().
Results are returned in AggregateResult only if a query() or queryMore() call includes the aggregate function. If the call doesn’t contain an aggregate function, the results are returned in the QueryResult SObject.
For example, this query returns an array of Contact records in the records field.
When a SOQL query contains an aggregate function, the record field returns an array of AggregateResult records. .
Fields
Each AggregateResult object contains a separate field for each item in the SELECT list. For the Enterprise WSDL, retrieve the result for each item by calling getField() on an AggregateResult object when using WSC client framework. For the Partner WSDL, retrieve the result for each item by calling getField() on an object.