+ Start a Discussion
Devaraj 7Devaraj 7 

how to get count of status in opportunity

Wilfredo Morillo 20Wilfredo Morillo 20
You need to use AggregateResult:
 
Select Count(Id), StageName from Opportunity Group By StageName;
This will return a count of each StageName.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_agg_fns.htm