17:05:05 SQL> select * from b;AA DD
-- --
A1 D1
A1 D2
A2 D3已用时间:  00: 00: 00.00
17:05:13 SQL> select aa,dd from
17:05:24   2  (select aa,decode((select count(*) from b d where d.aa=c.aa),1,dd,
dd||'等') dd from b c) a
17:05:24   3  where rowid=(select min(rowid) from b  where a.aa=b.aa);AA DD
-- ----
A1 D1等
A2 D3已用时间:  00: 00: 00.16

解决方案 »

  1.   

    select max(ta.aa) AA,max(tb.dd)||
    decode(max((select count(tb1.aa) from tb tb1 where tb1.aa=ta.aa group by tb1.aa)),1,' ','等') D
    from ta,tb
    where tb.aa=ta.aa
    group by ta.aa
    /
      

  2.   

    已写入文件 afiedt.buf  1  select max(ta.aa) AA,max(tb.dd)||
      2  decode(max((select count(tb1.aa) from tb tb1 where tb1.aa=ta.aa group by tb1.aa)),1,' ','等') D
      3  from ta,tb
      4  where tb.aa=ta.aa
      5* group by ta.aa
    SQL> /AA         DD
    ---------- ------------
    a1         d2等
    a2         ee
      

  3.   

    SQL> select * from ta;AA         BB         CC
    ---------- ---------- ----------
    a1         b1         c1
    a2         b2         c2SQL> select * from tb;AA         DD
    ---------- ----------
    a1         d1
    a1         d2
    a2         ee
      

  4.   

    select a.aa,a.dd||Decode(Count(*),1,' ','等') 
    from a,b
    where a.aa=b.aa
    group by a.aa,b.dd