Traversing a Parent / Child Table?
I have a Self-join开发者_如何学JAVA(parent/child) table that forms a TreeView control. in this structure only leaf nodes has a [Percent] value(persists in table only for leafs). and parent nodes values calculated from children(average values of children = parent [Percent] value).
How to write a procedure or function to calculate every node [Percent] values? any suggestions? i am beginner in sql and not familiar enough in sql statements and could not find any suitable article in the web. thank you!
Check out recursive Common Table Expressions
精彩评论