You need to sign in to do that
Don't have an account?
hemanth tanguturi 5
SOQL query for below scenario
Hi,
Scenario:
In the account object we have "parent account" lookup field. User is selecting parent account when creating an account.
Acc A ---> grand parent account
Acc B ----> parent account
Acc C----> Account
While creating Account B I have selected Account A as parent account.
While creating Account C I have selected Account B as parent account.
a) I want to query all parent account of C(which will inclue parent and grand parent). How can I achieve this?
b) For example account B is selected as parent account for both Acc C and Acc D then, I want a query to pull all child accounts for Account B
Thanks in advance
Hemanth
Scenario:
In the account object we have "parent account" lookup field. User is selecting parent account when creating an account.
Acc A ---> grand parent account
Acc B ----> parent account
Acc C----> Account
While creating Account B I have selected Account A as parent account.
While creating Account C I have selected Account B as parent account.
a) I want to query all parent account of C(which will inclue parent and grand parent). How can I achieve this?
b) For example account B is selected as parent account for both Acc C and Acc D then, I want a query to pull all child accounts for Account B
Thanks in advance
Hemanth
SELECT Parent_Account_c, count(Id) FROM Account GROUP BY Parent_Account_c
using this you can save lot of coding struggle.
Thanks
Sandeep Singhal