I have a treeview with companies. Each company can have subsidiary companies. Each subsidiary company can have its own subsidiary companies and this can continue indefinitely. Each company has its own revenues, and still has fullEarnings which is equal to the sum of all the revenues of the subsidiaries of this company.
I need to calculate the profit for each company, if you know each company's own earnings.
Example:
I have a ParentID column in the database whose values refer to the parent company ID.
How can i do this? Maybe through recursion?
