Thanks Ron I will take a look. You are correct someone can sponsor more then 2 people, they can sponsor as many people as they wish. However the sponsor tree and binary tree a very different.
For example a binary tree has two legs, our company populates one leg, and the opposite leg is up to the member to populate. IE: Say we populate B for both B and A root A B B B B B A A A B A B Now if we populate B in a strait line, meaning the A found under B that contains A and B it is up to A to fill both of them legs under it. Don't worry if you don't understand this, this entire process is quite complicated and also now our tree has over 20,000 nodes in it already. We predict 200,000 -> 500,000 nodes by the end of the summer. Where as a sponsor tree isn't a binary tree and is based on generations: you sponsor L1 sponsor L1 sponsor L1 sponsor L1 ... sponsor L2 sponsor L2 sponsor L2 sponsor L3 ... On Sun, Apr 8, 2012 at 9:10 PM, Ron McOuat <ron.mco...@gmail.com> wrote: > > Bruce, > > It might help, maybe not, but Pragmatic Programmers has a book called SQL > AntiPatterns with Chapter 3 dedicated to tree structures in databases > > http://pragprog.com/book/bksqla/sql-antipatterns > > They show several alternatives to the usual starting point of adjacency > lists to describe trees in databases. > > I don't understand your problem domain of MLM and I guess am not sure why > there would be only left and right child nodes at a particular level, I > would think a person could sponsor more than 2 people. > > The book discusses the SQL99 WITH keyword for recursive queries which > PostgreSQL supports since 8.,4 as well as alternative ways to express a > hierarchy in a table. > > Hope it is some use. > > Ron > > -- -- Regards, Bruce Wade http://ca.linkedin.com/in/brucelwade http://www.wadecybertech.com http://www.fittraineronline.com - Fitness Personal Trainers Online http://www.warplydesigned.com