2

I've tried to do an inner join SOQL query using Events/Tasks:

SELECT Id FROM Attachment WHERE ParentId IN (SELECT Id FROM Event) LIMIT 1000

But I failed with the error: "Entity 'Event' is not supported for semi join inner selects"

I was wondering which are the not supported entities; I tried to figure out at Salesforce documentation but I wasn't lucky at all.

Does anyone of you have this valuable information or knows where to find out?

1 Answer 1

4

At the bottom of Comparison Operators in the SOSL/SOQL reference, it gives you the information you're looking for

  • The following objects aren’t currently supported in subqueries:

    • ActivityHistory
    • Attachments
    • Event
    • Note
    • OpenActivity
    • Tags (AccountTag, ContactTag, and all other tag objects)
    • Task

My best guess at why these aren't currently supported is because these SObjects have polymorphic relationships. I imagine that makes it difficult for the query engine to determine how to proceed (how do we know if this row is related to the same object we're being told to filter against? is it possible to do that without looking deeper into the Id? how do we optimize this? etc...)

1
  • Thank you Derek! Very useful information. Agree with your comments, makes sense Jan 5, 2023 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .