select a as fromuser,b as touser from dual
union all 
select b,c from dual
union all
select e,c from dual
union all
select d,b from dual已知a,找到与其有关系的所有人
求大神??

解决方案 »

  1.   

    字符用单引号
    select 'a' as f,'b' as t from dual
    union all
    .
    .
    .
    搜索层次查询
      

  2.   

    不明白你要说什么。。
      
    with t1 as(
    select 'a' as fromuser,'b' as touser from dual
    union all 
    select 'b','c' from dual
    union all
    select 'e','c' from dual
    union all
    select 'd','b' from dual
    )select * from t1;
      

  3.   

    移动客户端发布的问题,我猜你在考试或者面试,猜你的意思,是要通过递归实现,具体写法去百度吧,start with connect by 
      

  4.   

    补充一下,已知道载体A,要查出与A有关系的实体B,及与实体B 有关联的所有其它载体。
    我知道start with  connce by nocycle 可以实现,但是要反转union all 才能实现。
    with  tt as 
    (select  f,t  
     from 
       (select 'a' f ,'b' t from dual
         union all 
        select 'b' f, 'c' t from dual
       )  
     union all 
     select  t,f 
    from 
      (select 'a' f ,'b' t from dual
         union all 
        select 'b' f, 'c' t from dual
       )  
    )
    select  tt.f,tt.t 
    from tt
    start  with  tt.f='a'
    connect  by nocycle prior tt.t=tt.f这个写法有点会出现重复,有没有便利点的写法?
      

  5.   

    a是b的儿子,b又生了a,b还生了c,c还是b的爸爸,我彻底疯了