数据写错了吧?!select aa,a1.name as bb,a2.name as cc,a3.name as dd
from b,a a1,a a2 a a3
where b.bb=a1.id
and b.cc=a2.id
and b.dd=a3.idor???:select aa,left(a1.name,4) as bb,left(a2.name,4) as cc,left(a3.name,4) as dd
from b,a a1,a a2 a a3
where b.bb=a1.id
and b.cc=a2.id
and b.dd=a3.id

解决方案 »

  1.   

    select aa
           ,(select left(name,4) from a where bb = b.id)
           ,(select left(name,4) from a where cc = b.id)
           ,(select left(name,4) from a where dd = b.id)
      from b
      

  2.   

    try
      select aa,
        left((select name from table1 where id=(select bb from table2 where aa=a.aa)),4),
        left((select name from table1 where id=(select cc from table2 where aa=a.aa)),4),
        left((select name from table1 where id=(select dd from table2 where aa=a.aa)),4) from table2 a
      

  3.   

    try again  select aa,
        (select left(name,4) from table1 where id=(select bb from table2 where aa=a.aa)),
        (select left(name,4) from table1 where id=(select cc from table2 where aa=a.aa)),
        (select left(name,4) from table1 where id=(select dd from table2 where aa=a.aa)) from table2 a
      

  4.   

    select aa
           ,left((select name from a where bb=b.id),4)
           ,left((select name from a where cc = b.id),4)
           ,left((select name from a where dd = b.id),4)
    from b
      

  5.   

    为什么按以上的各种方法得到的视图C为空???难道我有rpwt?????
      

  6.   

    原来我真的有rpwt呀,结贴了!!