In previous post, we had created a schedulable batch apex that implements Database.Batchable<sObject> in Salesforce, but if you want to use SOQL having aggregate functions like SUM(), MAX(), COUNT() on results grouped by “GROUP BY” clause in start execution, changing to interface Database.Batchable<AggregateResult> isn’t a workable way, because it fails with the below compile error […]

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. Group By 1.Simple Group BY 1.Group by […]