Number of Subaccounts per Master

You can use the script below to see how many subaccounts are linked to each master account

select b.Master_Account_Code as "Number of Subaccounts per MasterAcct", 

COUNT(b.Master_Account_Code) as "COUNT of subaccounts",

b.description as "Master Account Description"

from AR_Customer a, AR_Master_Account b

where a.Master_Account_Id >1

and a.Customer_Id <>1

and a.Customer_Id <>b.Customer_Id

and a.Master_Account_Id = b.Master_Account_Id 

group by b.Master_Account_Code, b.Description 

order by COUNT(b.Master_Account_Code)

Was this article helpful?
Thank you for your feedback!
User Icon

Thank you! Your comment has been submitted for approval.