select a.id,decode(b.amount_can,0,null,a,amount1),a.date,b.amount2,b.amount_can 
from table1 a,table2,b
where a.id=b.id

解决方案 »

  1.   

    select a.id,decode(b.amount_can,0,null,a.amount1),a.date,b.amount2,b.amount_can 
    from table1 a,table2,b
    where a.id=b.id
      

  2.   

    谢谢,不过我这里好象不太好根据其他字段来判断,我重新写下表。
    table1
    ===============
     id  amount1  date 
     1   200     060301
     2    50     060302
    ===============table2
    =============== 
     ForKeyID |amount_NO| need_amount | need_amount_can |applyID
     1        |   1     | 50          |   0             | 1
     1        |   2     | 100         |   0             | 1
     1        |   3     | 100         |   50            | 1
     2        |   3     |  50         |   0             | 2
    ===============