function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BroncoBoyBroncoBoy 

Opportunities Aggregate Query Group By RecordType & ContactId

Any ideas on how to query for Opps created last month (for certain recordtypes only) and group by ContactId then by record type?

Query:  SELECT COUNT(Id) idSum, SUM(Consolidated_Opportunities_Count__c) consolidatedSum FROM Opportunity WHERE CreatedDate = LAST_MONTH AND (RecordType.Name = 'A' OR RecordType.Name = 'B' OR RecordType.Name = 'C') GROUP BY ContactId, RecordTypeId 

Thanks fo your help!
Bronco