Group by multiple fields in SOQL

In this post I’ll show you the useage of Group By in SOQL.
*Amazingly,SOQL supports groupping with multiple fields.

The data

I have prepared the data by Saels__c sObject, whose Account__c field is reference to Account,User__c field is reference to User, and Amount__c field is a Currency field.
1

Group By

1.Simple Group BY

2

1.Group by two fields

3

1.Use GROUP BY ROLLUP

Use the ROLLUP in SOQL query will add subtotals for aggregated data in query results.
4