http://expert.csdn.net/Expert/topic/1361/1361492.xml?temp=.4580957
http://expert.csdn.net/Expert/topic/1375/1375432.xml?temp=.3430445
http://expert.csdn.net/Expert/topic/1343/1343007.xml?temp=.730694
老大:
这三片高论足够解决你的问题!
:)(:

解决方案 »

  1.   

    老大:
       有没有接受到我的Email?
      

  2.   


    create table #temp
    (id char)
    declare @id char
    set @id = 'a'
    insert into #temp values (@id)
    while exists (select bomid from tree where parent_id in (select * from #temp) and bomid not in (select * from #temp) )
       insert into #temp select bomid from tree where parent_id in (select * from #temp) and bomid not in (select * from #temp)select * from #temp
      

  3.   

    create table #temp
    (id char)
    declare @id char
    set @id = 'a'
    insert into #temp values (@id)
    while exists (select bomid from tree where parent_id in (select * from #temp) and bomid not in (select * from #temp) )
       insert into #temp select bomid from tree where parent_id in (select * from #temp) and bomid not in (select * from #temp)select * from #temp