下面的例子是什么查询 [英] what is query for below example
问题描述
我有一个问题,就是我试图从数据库中检索数据.
我说得很清楚,
我有一个名为的表:details.mdf
字段
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
我可以为以下结果做什么:
Q0006的发起人,答案是:Q0003,然后Q0003的发起人是谁,答案是:Q0001等……
从而动态地从数据库中检索数据.我认为,为此,我们可以使用循环.但是我不知道什么是正确的代码,因为所有的值都是字符串.请帮助我以这种方式检索数据吗?
在此先感谢
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
推荐答案
请检查以下链接,其中包含示例:
http://www.eggheadcafe.com/software/aspnet/30998209/sql- 2005-recursive-query.aspx [ ^ ]
Please check the following link, which has example:
http://www.eggheadcafe.com/software/aspnet/30998209/sql-2005-recursive-query.aspx[^]
这篇关于下面的例子是什么查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!