SELECT AS lev1, as lev2, as lev3, as lev4, 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 = '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..