In my org i have a lot attachments available (55,000) and i need to export only those attachments which has Account.field__c = 'ABC' (10,000).

I am not sure this is possible in SOQL or not as i tried and it gives me an error, can anyone please tell me how to export those attachments only ?

What i have tried : Select Body, Name, ParentId from Attachment where Parent.Type = 'Account' AND Account.field__c = 'ABC'

I know above where clause is very typical but hopefully it might let you understand what exactly i need.



You can use a subquery filter for this:

SELECT Body, Name, ParentId 
FROM Attachment
WHERE ParentId IN (SELECT Id FROM Account WHERE Field__c = 'ABC')
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.