There are six Events created for Opportunity 'ABC' with the same Subject name and I need to count all these Events based on Status field.
I am using the below query for fetching the Events but it returns only one Event. The first event was created in 2018 and four events in 2019 and one in 2020, the query returns the event which is created in 2020.
"SELECT Id,(SELECT Id,Event_Status__c FROM Events) FROM opportunity where id='xxxxxxxxxx'"
How I can count all these events by using apex, please suggest. Any help would be appreciated.