So, I have hierarchy table where I want the sum of children (cumulative sum) added to all parent.
I have 2 tables dimension and valuation. I need to sum up volumeimpact based on a dimension tree.
http://sqlfiddle.com/#!15/5c0e7/5
id dimensionvalueid name volume cumulativeSum
1 (null) one (null) 700
2 1 five 200 700
3 2 sixteen 200 500
4 3 eighteen 200 300
5 3 random 100 100
6 (null) root 300
7 6 yellow 100 300
8 6 orange 100 200
9 8 green 100 100