• stormrider_05
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hello,

 

Is there a way to find only those Accounts which have an Activity of a certain type in their ActivityHistory and exclude the ones that don't?

 

My current query looks like this:

 

SELECT Id, Name, ( SELECT Id, ActivityType, ActivityDate, Description, Status, Owner.Id, Owner.Name FROM ActivityHistories WHERE ActivityType = 'my_activity_type' ORDER BY

ActivityDate DESC ) FROM Account



What I want is only Accounts where ActivityHistories is not empty. e.g WHERE AccountHistories != null or so.

 

I know that I could just collect the Ids of the relevant accounts manually and do a second query. But since the number of Accounts in the system is > 40000 I'd rather get it all done in one step.

 

Thank you for your help!

 

Hello,

 

Is there a way to find only those Accounts which have an Activity of a certain type in their ActivityHistory and exclude the ones that don't?

 

My current query looks like this:

 

SELECT Id, Name, ( SELECT Id, ActivityType, ActivityDate, Description, Status, Owner.Id, Owner.Name FROM ActivityHistories WHERE ActivityType = 'my_activity_type' ORDER BY

ActivityDate DESC ) FROM Account



What I want is only Accounts where ActivityHistories is not empty. e.g WHERE AccountHistories != null or so.

 

I know that I could just collect the Ids of the relevant accounts manually and do a second query. But since the number of Accounts in the system is > 40000 I'd rather get it all done in one step.

 

Thank you for your help!