2

I am trying the following SOQL query and getting an error stating the query is malformed.

Select Id from Program__c Where Id In
(Select ParentId from Attachment
where Description LIKE '%Resume%')
1
  • I don't have access to an org right now, but I will say that LIKE isn't case sensitive. Try using just one.
    – sfdcfox
    Commented Nov 4, 2014 at 18:10

2 Answers 2

4

I tried the same query using Account rather than Program__c and got the message:

Entity 'Attachment' is not supported for semi join inner selects.

Instead you can rework the query to get the same data.

Select ParentId from Attachment where Description like '%Resume%' and parent.type = 'Program__c'

You already have the ParentId with the ID of the Program__c record so you don't need the In clause.


Note that the Understanding Relationship Query Limitations documentation states:

You cannot filter against the content of textarea fields, blobs, or Scontrol components in any object.

That doesn't appear to be correct with respect to the Attachment Description textarea field as the query returns the expected results.

1

I see at least one problem, which is that it is not possible to filter on the Description field (or any long-text field for that matter) in the WHERE clause of your SOQL.

1
  • I just tried a direct query against Attachment and was able to have a LIKE clause against the Description field. The Description field is of text area rather than a long text area. This seems to contradict the documentation which says: "You cannot filter against the content of textarea fields, blobs, or Scontrol components in any object" Commented Nov 4, 2014 at 18:55

You must log in to answer this question.

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