• Final result should be 25 or 25.37 to be precise. This the sample table data. Task is calulate the value of root of the tree that is Task1(First row) by using its children. For Ex. thirs row id_task=3 it is unique for every row and identify the task number. level_task = 3, that is it belongs to the third level in the tree. id_fathertask = 2 means, its parent the one which has id_task as 2, that is Task 1.1(second row). The result of the calculation should go to the percent_task of their parent. Hence we start the calculation from the lowest level in the tree and result goes to its parent and finally we find the value of the root.

    id_task id_fathertask level_task duracion_task percent_task name_task

    1 1 1 76 NULL Task 1

    2 1 2 60 NULL Task 1.1

    3 2 3 2 100 Task 1.1.1

    4 2 3 38 NULL Task 1.1.2

    5 4 4 10 100 Task 1.1.2.1

    6 4 4 22 20 Task 1.1.2.2

    7 4 4 5 35 Task 1.1.2.3

    8 4 4 1 40 Task 1.1.2.4

    9 2 3 20 NULL Task 1.1.3

    10 9 4 20 20 Task 1.1.3.1

    11 1 2 9 NULL Task 1.2

    12 11 3 2 0 Task 1.2.1

    13 11 3 7 NULL Task 1.2.2

    14 13 4 2 50 Task 1.2.2.1

    15 13 4 5 50 Task 1.2.2.2

    16 1 2 10 0 Task 1.3

    17 1 2 20 0 Task 1.4

    18 1 2 6 NULL Task 1.5

    19 18 3 6 NULL Task 1.5.1

    20 19 4 6 NULL Task 1.5.1.1

    21 20 5 6 10 Task 1.5.1.1.1