• Flora Liu
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
What I have:
An accountId: '001R0000005Xk58IAC'

What I want to get:
1. Events based on the accountId.
Query I have: 
SELECT id FROM Event where AccountId = '001R0000005Xk58IAC'

2. EmailMessage based on the accountId (it's called relatedToId in emailMessage object).
Query I have: 
SELECT id FROM EmailMessage where relatedToId = '001R0000005Xk58IAC'


My question is, how can I use ONE query to get both of them?
Are there something like:
SELECT (Event.id, EmailMessage.id) from (Event, EmailMessage) where event.accountId = '001R0000005Xk58IAC' AND emailmessage.id = '001R0000005Xk58IAC'

By the way, I just need to get the number of the returned results, which means I just need to know the event.count + emailMessage.count, but I want to get them in one query.

Thanks.