Skip to content

Instantly share code, notes, and snippets.

@isanuki
Last active December 15, 2015 23:59
Show Gist options
  • Save isanuki/5343900 to your computer and use it in GitHub Desktop.
Save isanuki/5343900 to your computer and use it in GitHub Desktop.
SOQL GROUP BY サンプル
AggregateResult[] results = [SELECT StageName, SUM(Amount) summary
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageName];
for(AggregateResult ar: results){
System.debug('フェーズ='+ ar.get('StageName')
+ ':金額='+ ar.get('summary'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment