Isaac - thanks for the information. I'm going to take your pointers and start doing some data modeling to see if I can make this work. I wonder if I can denormalize the data into a 4th table as things progress to keep the madness to a minimum..
-----Original Message----- From: S. Isaac Dealey [mailto:info@;turnkey.to] Sent: Thursday, October 24, 2002 4:43 PM To: CF-Talk Subject: Re: Binary marketing tree in CF/SQL > I have a client who wants me to build a "No-flush Binary marketing" > application in SQL and CF. I've looked at several > examples and really > don't know how to approach building an infinite tree > structure of this > sort. Can anyone point me to resources for learning how > to develop this > type of system, implementing business rules and > calculating commissions? > I've never worked with MLM stuff. At first glance it > seems fairly > simple, but the further I get the more questions pop up. > The big thing > here is probably speed in calculating the left/right percentages and > processing downline commissions - it's an infinite > structure... > Anyway, thanks for any information anyone can provide. I hate working on MLM stuff... The code to maintain the tree and calculate commissions is a nightmare... I typically use the NTM model stuff for the database like Joe Celko's sql for smarties stuff... Have a cross-reference table that shows all downline as related to all upline, with a 3rd column for "separation". The separation column can then be related to a 3rd table with just separation and percentage, that way you can pull commissions vairly easily from the db. select upline.membername, upline.memberid, xref.separation, (xref.percentage * ... ) AS commissionvalue, donwline.memberid, downline.membername from members upline left join xref on ( xref.uplineid = upline.memberid ) left join members downline on ( downline.memberid = xref.downlineid ) The larger problem is likely to be maintaining the xref table -- I've been doing this recently and having a lot of problems with SQL Server running out of resources to perform an update. Fortunately I haven't had to work on MLM stuff very often... hth Isaac Certified Advanced ColdFusion 5 Developer www.turnkey.to 954-776-0046 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm

