Hi

For performance reasons, the best way to deal with
the network  is to separate it from your "clients" table
because you would be searching the network heavily
and if the table is short, that would be much faster.

So, create a new table called "network" with only
two integer fields, where you put the unique id of the
client (id1), and referrer's account (id2).

To find first level people below, you do:
"select id2 from network where id1=1"
where number 1 is the id of the client you are searching
for.

To find second level people you do:
select id2 from network where id1 in (select id2
from network where id1=1)

and so on. (Note that the subquery is the same as
the previous query)

You must change this to use temporary tables because
MySQL doesn't support subselects yet.  :-(

Hope that help you

-------------------------------
Andres Berger Garcia
Gerente de Marketing
Preventix S.A.C.
--------------------------------------
http://www.zapantivirus.com



----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, August 18, 2001 12:45 AM
Subject: Nesting Problem for Multilevel Marketing


> Hi Everyone,
>
> I have a few questions based on a scenario that was posed to me, and I
have
> no idea how to go about it...
>
> For example, a multi-level / multilevel marketing project has the
following
> Membertable with 2 fields for a generated Account Number....  the first
field
> is Member's Unique Account Number (Column A) and the second field is
> Referrer's Account Number (Column B)...
>
> So if I join the multilevel program, I will have to provide my recruiter's
> Account Number which will be placed in Column B and I will be given my new
> Account Number which will be placed in Column A.
>
> The problems would be: how do I generate a Member's Report, which will
show
> the five members above me, and the five LEVELS of numerous members which
join
> below me.
>
>
>

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to