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

Parent to Child SOQL Inner Join

Is there any way to make this query only return the custom object records that have attachments?  When I run this query it returns all of the custom object instances for the specified account even if they don't have an attachment.  Then I have to loop through the list to actually find the attachments.

Select,,, (select, a.createddate from attachments a)
from custom_object__c c
where c.accountid = 'xxxxxxxxxxxxxxx'
order by c.createddate desc
Not today.  With winter '09 we did introduce Semi/Anti joins syntax that allows filtering the way you describe but unfortunately polymorphic relationships like Task.What, Task.Who and Attachment.Parent are disallowed at this time.
Is it on the roadmap to support Polymorphic keys in semi/anti joins?  Is there an idea out there for that, that I could promote?
There is not an idea yet that I have seen. As this is new functionality and people have not yet seen this limitation to a great extent it's pretty likely that there isn't.  Please do create one.


Here is the idea.  I think I stated it correctly.  Please let me know if you see any inconsistencies.

Vote for the idea

Please vote if you think this is needed functionality.

Message Edited by JoshVH on 11-14-2008 08:35 PM
Yep. You got it right, thanks for creating it!