Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Oracle (http://www.go4expert.com/forums/oracle-forum/)
-   -   tree calculation (http://www.go4expert.com/forums/tree-calculation-t20974/)

rogermou 13Feb2010 03:04

tree calculation
 
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


All times are GMT +5.5. The time now is 10:53.