SELECT t1.name AS lev1, t2.name as lev2, t3.name as lev3, t4.name as lev4,t5.name as lev5
FROM members AS t1
LEFT JOIN members AS t2 ON t2.upline_id = t1.member_id
LEFT JOIN members AS t3 ON t3.upline_id = t2.member_id
LEFT JOIN members AS t4 ON t4.upline_id = t3.member_id
LEFT JOIN members AS t5 ON t5.upline_id = t4.member_id
WHERE t1.name = 'B';

hello.. can someone help me.. we're developing some binary multi level marketing
parent child relationship.. the following code can be useful if we only have 2 to 5 levels
we can just left join it.. but my problem is how about if the levels are 50+ ... how can i query that..

6 Years
Discussion Span
Last Post by smantscheff
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.