Is it possible to group by a common field value? There is no aggregate integer, just simply a shared value in a custom field.
For example:
SELECT Franchise_Account__c, Id,
FROM Account
WHERE Franchise_Account__c IN (:franchise_accounts)
AND RecordType.Name = 'Customers'
In this result each Customer
belongs to a Franchise_Account__c
, so I would like them grouped by that.
Essentially I would like to have a Map object to index them by, something like
Map<Id,List<Account>> => Map<Franchise_Account__c,List<Custom Accounts>>
Any thoughts on how to make this happen would be AWESOME!