Below query is on Opportunity object and on Amount Field.
1 2 3 4 5 6 7 8 9 10 11 | Aggregateresult[] aggresult= [Select COUNT(amount)countt, SUM(amount)sum, MIN(amount)min, MAX(amount)max, AVG(amount)avg from Opportunity]; System.debug('opportunity Count amount******'+aggresult[0].get('countt')); System.debug('opportunity SUM amount******'+aggresult[0].get('sum')); System.debug('opportunity MIN amount******'+aggresult[0].get('min')); System.debug('opportunity MAX amount******'+aggresult[0].get('max')); System.debug('opportunity Average amount******'+aggresult[0].get('avg')); |
No comments:
Post a Comment