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 |
mrsqlserver
Starting Member
6 Posts |
Posted - 2014-07-09 : 01:17:25
|
I want to do this query on sql serverI can do this with loop but would like to know if there is any easier way that has better performanceI have table for referrals , scenario 1 : if A has 5 points and refer B that has 7 then the query should show 12 pts for A (A points + B points) scenario 2 : if A has 5 and refer to B that has 7 and A refer to C that has 3 points and B refer to D that has 4 pts and so on.. in this case A takes all points of people A + B + C + Dmy table look like thisRefssID bigintsName varchar(50)sPoints intsRefID bigint |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|
|