Visual Studio .NET - how to create a Recursive Function to retrieve the sum parent child table in vb.net

Asked By Alamdar KHAN on 19-Sep-15 01:39 AM

For further explanation I have attached an image given below.

I am developing an account application where it is necessary to create a "Trail Balance" in it. for the trail balance i have created view(sql query) to retrieve the data. So my question is basically to calculate / sum the balances of the child records to its parents like examples given in the below image. I know for this purpose I would retrieve it by the RECURSIVE function! BUT HOW?.

Your response will be highly appreciated because I am still busy in the regarding task since last 1 week.  thank you.

the following column are used: AcID, AcTitle, ControlAccID or ContAcID and Balance

Robbe Morris replied to Alamdar KHAN on 19-Sep-15 05:45 PM
https://www.nullskull.com/articles/sql_server_recursion_with_clause.asp

https://www.nullskull.com/a/896/sql-server-2005-cte-common-table-expression.aspx

https://www.nullskull.com/a/1243/cte-common-table-expression-in-sqlserver-2005.aspx