function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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