GROUP BY | SOQL and SOSL Reference | Salesforce Developers You can use the GROUP BY option in a SOQL query to avoid iterating through individual query results That is, you specify a group of records instead of processing many individual records
SOQL GROUP BY: COUNT, HAVING, ROLLUP and Examples SOQL GROUP BY returns one row per distinct value of a field, with an aggregate such as COUNT (Id) or SUM (Amount) beside each value The clause order is fixed: It runs anywhere SOQL runs: the Developer Console Query Editor, inline Apex, the sf CLI and the REST and SOAP APIs
What types of fields are groupable in a SOQL `GROUP BY` clause? Groupability breaks down pretty cleanly along type lines, with a few interesting nuances The underlying SOAP type appears to be the primary determinant, and some formula fields can be used as groupings Types are listed below by UI type, with the SOAP type in parentheses
SOQL Query on Group and GroupMember in Salesforce A SOQL query on Group and GroupMember answers most group questions in Salesforce: filter Group by Type to list public groups and queues, query GroupMember to see direct members, and use semi-joins on User or Group to turn the IDs into names
Group Your Data into Categories | Salesforce Help Group data to organize it so that the data is displayed in useful categories You can group your data by up to ten dimensions or date fields in charts and tables, except in blended queries