Skip to content

Instantly share code, notes, and snippets.

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