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
Ed055Ed055 

How can I get parent accounts without child

Is there a way I can get all parent accounts who do not have cany child accounts?  Thanks for help.
siddarth rajsiddarth raj
If possible Can you make it more clear What is your problem
Ed055Ed055
I'm just tring to get report or data dump of all the accounts which do not have and child accounts associated with it.
Deepak BalurDeepak Balur
Accounts can be associated to its Parent so by default all Accounts created are stand alone or "child", this is for standard SF functionality.
You can use the following to find standalone accounts having a parent or missing (with some tweak)
Select a.Id,a.ParentId, a.AccountNumber From Account a where a.ParentId <> null limit 100
Ed055Ed055
Here is the scenario ...
I have two account records types "A" AND "B"

Accounts whose record type "A" will always be parent of Accounts with record type "B"  

I'm trying to get a report or a data dump of all the Accounts whose record type is "A"  and are NOT listed as parent of Accounts with record type B

Thanks

 
BalajiRanganathanBalajiRanganathan
you can try this SOQL
SELECT Id, Name FROM Account WHERE ParentId = null and 
Id NOT IN (SELECT ParentId FROM Account)