我想直接用SQL语句取得结果,因为我是用PB的DataWindow检索数据!

解决方案 »

  1.   

    select ab01_ID,ab02_Name name,ab01_Data from ab01,ab02
    where ab01_ID = '01' || ab02_ID
    union all
    select ab01_ID,ab03_Name name,ab01_Data from ab01,ab03
    where ab01_ID = '02' || ab03_ID
      

  2.   

    SQL> select a1,a2 from a;A1         A2
    ---------- ----------
    0101       aaa
    0201       bbbExecuted in 0.016 secondsSQL> select b1,b2 from b;B1         B2
    ---------- ----------
    01         Executed in 0.016 secondsSQL> select c1,c2 from c;C1         C2
    ---------- ----------
    01         firstExecuted in 0 secondsSQL> select a1,b2,a2 from a,b where a1='01'||b1
      2  union
      3  select a1,c2,a2 from a,c where a1='02'||c1
      4  ;A1         B2         A2
    ---------- ---------- ----------
    0101              aaa
    0201       first      bbbExecuted in 0.016 secondsSQL>
      

  3.   

    select ab01_ID,decode(substr(ab01_ID,1,2),
    '01',(select ab02_Name from ab02 where '01' || ab02_ID=ab01_ID),
    '02',(select ab03_Name from ab03 where '02' || ab03_ID=ab01_ID),
    '') name, ab01_Data from ab01