|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
VeriSign Code Signing Digital Certificates provides assurance to end users. Read about this and more in the free white paper: “How to Digitally Sign Downloadable Code for Secure Content Transfer.” Learn More! |
|
#1
|
|||
|
|||
|
database design problem
i have to design database for a mlm (multi lavel marketig) project.
it starts from one member... and then that person refers two people... and then every new comer refers more two.. in this way .. a BINARY TREE starts growing... by binary it means that... every entity has two childs.... hope you are getting it.... its like. ........1 ....../...\ .....2.....3 ..../\....../\ ...4..5....6..7 ../....\../....\ .8......9.10...11 here any member gets commission each time he has 4 new members on his right or left. e.g. member(7) gets a new member(11) on his right. this way member(1) now has 4 members on his right side and commission will be added for member(1). ........1 ....../...\ .....2.....3 ..../\....../\ ...4..5....6..7 ..............\ ...............(11) and when member(11) gets 4 new members like this: ........1 ....../...\ .....2.....3 ..../\....../\ ...4..5....6..7 ..............\ ...............11 ............./....\ ..........(12)....(13) .............\.......\ ...........(14)......(15) now member(1) will get commission for 4 new members(12,13,14,15) (he has already got commission for 3,6,7 and 11 and he needs one more member on his left to get new commission for 4 new members). and mebmer(3) will get commission for 4 new members on his right(7,11,13,15). now I dont know how to design database for this problem that is efficient each time a new member is added to the tree, so that it will add commission accurately upward in the tree as described above. Last edited by aqeelahmad : May 1st, 2003 at 12:33 PM. |
|
#2
|
||||
|
||||
|
I hate that pyramid stuff...
Anyway, look if this applies to you (checkout the links at the bottom of the page as well). -> http://www.sitepoint.com/print/1105 //NoXcuz
__________________
UN*X is sexy! who | grep -i blonde | date; cd ~; unzip; touch; strip; finger; mount; gasp; yes; uptime; umount; sleep |
|
#3
|
|||
|
|||
|
With the outline you have laid out it is difficult to tell, but are your members going to sign up only 2 new members each and then quit, or will they continually be signing more and more members.
2 Member method: Members_t -------------- ID NUMBER(9) pk Name VARCHAR(?) Commision NUMBER(7,2) Father NUMBER(9) Mother NUMBER(9) .........1 ........./\ ........2 3 ......./\ /\ ......4 7 ....../\ .....5 6 Etc. Multi-tier Pyramid method: Members_t --------------- id NUMBER(9) pk name VARCHAR(?) commision NUMBER(7,2) parent NUMBER(9) Member 1 |- Member 2 | |- Member 3 | |- Member 4 | | |- Member 5 | | |- Member 8 | | | |- Member 7 | |- Member 9 |- Member 10 Then all you need to do is write some counting procedures. Easiest method would be to count the total of child members, divide by 4, then multiply the commision for the member. If you have to have a right and left side of the tree you can split the info into more tables and join them: Member_t ------------- id NUMBER(9) pk name VARCHAR(?) commision NUMBER(7,2) tree_left_t -------------- id NUMBER(9) pk parent_id NUMBER(9) child_id NUMBER(9) tree_right_t --------------- id NUMBER(9) pk parent_id NUMBER(9) child_id NUMBER(9) Then run your commision calculations. Last edited by rsingleton : May 9th, 2003 at 08:43 AM. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > database design problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|