I have a problem that is, I trying to retrieve data from database to the extent.
I explain very Clearly,
I have a table named: details.mdf
Fields: sponsor, nameofmember, memberid, dateofjoining
Q0000 ashi Q0001 12-20-2009
Q0000 sfgsf Q0002 13-20-2009
Q0001 dghdh Q0003 12-20-2009
Q0000 tyety Q0004 12-20-2009
Q0001 gdhdgh Q0005 12-20-2009
Q0003 gdh Q0006 12-20-2009
Q0002 ghf Q0007 12-20-2009
what can i do for result like this below:
sponsor of Q0006 , answer is : Q0003 and then who is the sponsor of Q0003 , answer is: Q0001 etc......
Thus dynamically retrieve the datas from database . I think, for this we can use loop. but I dont know what is the correct code for this purpose because of all the values are string . Please help me to retrieve datas in this manner?
thanks in advance

Krishna GaradRank #191 · 12.8K reputationPosted Feb 7, 2011, 11:06 PM EST
jaheena jamal75 reputationPosted Feb 8, 2011, 12:03 AM EST
Krishna GaradRank #191 · 12.8K reputationPosted Feb 8, 2011, 12:06 AM EST
ReferThis
jaheena jamal75 reputationPosted Feb 8, 2011, 12:49 AM EST
Krishna GaradRank #191 · 12.8K reputationPosted Feb 8, 2011, 12:53 AM EST
jaheena jamal75 reputationPosted Feb 8, 2011, 1:24 AM EST
jaheena jamal75 reputationPosted Feb 8, 2011, 1:40 AM EST
Krishna GaradRank #191 · 12.8K reputationPosted Feb 8, 2011, 1:43 AM EST
select e1.nameofmember 'Sponcer',e2.nameofmember 'Sponcer2'
from tree e1 join tree e2
on e1.sponsor=e2.memberid
Suthish NairRank #92 · 22.8K reputationPosted Feb 8, 2011, 9:39 AM EST
select distinct 'sponser of memberid ' + b.memberid + ' is ' + a.sponsor from dbo.details a left join dbo.details b on a.sponsor = b.sponsor