This question already has an answer here:
- SOQL Query of lookup relationship 2 answers
I am quite new to SOQL so I don't know if it is even possible this way. I want to have query like this:
Account childrenAccs; ... Account parentAccs = [SELECT Id, ParentId FROM Account WHERE Id IN :childrenAccs.ParentId];
With this query I want to get all Accounts, which have Id equal to ParentId of any Account from childrenAccs collection. Is this possible to achieve somehow? Or I have to extract
childrenAccs and use that in the condition WHERE IN instead?
Thanks a lot for advices