SELECt name a,
(select name2 from tableB where tableb.name= tablea.a) as b FROM tableA where id='1203';

解决方案 »

  1.   

    我要得到当前tableA的a的值
    也就是a 有1、2、3 当a=1、name2的值,a=2时name2的值匹配显示?我不清楚是不是可以!!
      

  2.   

    SELECt name as a,
    (select name2 from tableB where name=tableA.a) as b FROM tableA where id='1203';
      

  3.   

    不会是要这样的吧
    SQL> select * from tableA;NAME
    ----
    1
    2
    3
    4SQL> select * from tableB;NAME NAME2
    ---- -----
    1    aa
    2    bb
    5    ee
    6    ffSQL> select tableA.name,tableB.name2
      2  from tableA,tableB
      3  where tableA.name=tableB.name;NAME NAME2
    ---- -----
    1    aa
    2    bb
      

  4.   

    SELECt name as a,
    (select name2 from tableB where name=a) as b FROM tableA where id='1203'
    我想将外部得到的a的值,作为内部SQL的一个参数条件
    当a=1是括号内SQL应为(select name2 from tableB where name='1')
    当a=2是括号内SQL应为(select name2 from tableB where name='2')
      

  5.   

    只要这句是唯一值就可以了(select name2 from tableB where name=a)
      

  6.   

    Select A.name  
    From  TableA A,(Select name2 From TableB Where name=a) Temp
    where Temp.name2=A.Name and A.id='1203'
      

  7.   

    SQL> select * from a;ID   lxid C  D
    ---- -- -- ----
    11   2  19 48
    12   2  29 58
    13   2  39 68SQL> select * from b;ID   ST C  name
    ---- -- -- ----
    11   fd f  name1
    11   dd dd name1
    12   22 ss name1
    11   dd ff name2
    12   fa ff name2
    13   ff ff name2
    得到的在a 表lxid相同情况下,显示所有a.id,b.name, 条件:表b的name=name1
    ID不能重复,显示所有a.id b表的id没有13,name应显示null
      

  8.   

    hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh