• Sorry, I accidently posted without comments.

    the last value in the each row is the intermediate result. In the procedure I will pass the parameters as Heighest level and its id_father and id_task. First one is id_task next is id_father and level_task(heighest level available in the tree).

    like 21, 20, 5 from the table.