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
Andrew AldisAndrew Aldis 

How can I query activity history

I am trying to write a query that pulls a list of account Owners and their activity history then aggregates the activity histry using count(), but it will not let me count on a sub query.   I am also not able to query the activity history without querying the account.  Is there a way around either of these restrictions?

Select
(SELECT OWNER.Name
FROM ActivityHistories
where (ActivityType = 'Discovery Demo' ) OR (ActivityType = 'Discovery Interview')
)
From Account
Where Target_Account__c = True OR Target_Prospect__c =  True