Skip to main content Stream TDX Bengaluru on Salesforce+. Start learning the critical skills you need to build and deploy trusted autonomous agents with Agentforce. Register for free.

Hi, We are using the Account hierarchy in our Org. I am trying to generate a report which which identifies active parent accounts associated with no active child accounts.  I have written a query as follows: SELECT id, name, HN_Is_Active__c FROM account WHERE recordtype.name = 'Parent' and active_c = true and id not in (select ParentId from account where active_c = true and recordtype.name = 'Child')  but it gives the error 'The inner and outer selects should not be on the same object type'. I understand that Salesforce restricts querying the same object in the inner and outer queries. Can anyone suggest some other way to generate this report?  Thanks

1 answer
0/9000