Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
zafarthesultan
Starting Member
16 Posts |
Posted - 2010-01-16 : 09:14:04
|
| Dear Friends, I am getting a lot of help from this forum. Thanks, now my sql query requirement is something like:I have to calculate the business points a user obtains by referring other members. For example:A introduces B (A gets 50 points)A introduces C (A gets 50 points)B introduces D (B gets 50 points)B introduces E (B gets 50 points)C introduces F (c gets 50 points)C introduces G (c gets 50 points)This chain continues ( basically it is a binary tree structure. B and C are under A's left and right respectively ). The points for A will be a sum of all the points generated by members to his left and the members to his right.For every member in this tree the reward points should be calculated as follows:If a member has 500 points to his left and 250 points to his right, or 500 points to his right and 250 points to his left he will get 200 reward points. After initial 250:500 or 500:250 points the member will get 100 reward points for every 100:100Can anyone solve this query? Please, I need it for my project. Thanks a lot once again. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-01-16 : 09:44:24
|
How are you storing the data? N 56°04'39.26"E 12°55'05.63" |
 |
|
|
zafarthesultan
Starting Member
16 Posts |
Posted - 2010-01-16 : 09:51:10
|
| MasterUsers Table Format:id/userid/introducer/businesspoints/leftmember/rightmember1/A/Z/50/B/C2/B/A/50/D/E3/C/A/50/F/G4/D/B/50/null/null5/E/B/50/null/null6/F/C/50/null/null1/G/C/50/null/null |
 |
|
|
|
|
|