Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have been facing some problem to calculate profit in matrix mlm plan.

I this plan each Node can have 3 nodes

For level 1 Total Node count 3 , parent node will be get benefit of 90 Rs. Means 3 × 30@=90
Level 2 - node count 27 benefit will be
27× 10= 270

Level 3 node count 81 , benefit 81× 5=405

.........and so on ...

What I have tried:

I have tried to calculate profit at time of user registration form sql server stored procedure.
Updated 10-Feb-20 9:31am
Richard MacCutchan 10-Feb-20 3:36am
Please edit your question and show the failing code, and explain exactly where the problem occurs.
Dave Kreskowiak 10-Feb-20 15:31pm
You do know that MLMs are a scam, right?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

to me on the basis of what you stated I would utilize a loop and scalar function

I wouldset each level as an increment in a loop. For each increment send to the function, the level and the values associated with that level.

The scalar function would carry all logic for the levels.

Based on the above I am only giving you what is off the top of my head as I feel your question lacks some further detail to answer the question more specifically.

while loop tsql
WHILE (Transact-SQL) - SQL Server | Microsoft Docs[^]

create function tsql


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100