tree calculation

Discussion in 'Oracle' started by rogermou, Feb 12, 2010.

  1. rogermou

    rogermou New Member

    Joined:
    Feb 12, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    hi,
    i have this table
    Emp Sum_sales Manager Child
    10 0 Null 0
    11 130 10 1
    12 260 11 2
    13 0 12 3


    the number of children is not limited.

    i need to calculate the comm of the employees: the result should be like that:
    emp10=(sum_sales of emp 11 * child 1 perc)+(sum_sales of emp 12 * child 2 perc) + (sum_sales of emp 13 * child 3 perc)

    emp11=(sum_sales of emp 12 * child 2 perc) + (sum_sales of emp 13 * child 3 perc)

    emp12 = (sum_sales of emp 13 * child 3 perc)

    how should i write the script to get this result ur help is really appreciated

    best regards,
    Roger
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice