Mehdi
Mehdi

Reputation: 5597

Traversing a Parent / Child Table?

I have a Self-join(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!

Upvotes: 1

Views: 744

Answers (1)

Magnus
Magnus

Reputation: 46919

Check out recursive Common Table Expressions

Upvotes: 1

Related Questions