select a.acct_id,a.ACCT_SEQ_NBR,a.sell_id
from lbas.acct a
where not exists
(select 'X'
from charge.b_acct b 
where a.ACCT_ID = b.ACCT_ID and 
a.ACCT_SEQ_NBR = b.ACCT_SEQ_NBR and 
a.sell_ID = b.sell_ID)

解决方案 »

  1.   

    楼上的师兄,你的SQL统计不能完全实现我的要求啊 我需要的是如果这个字段有不同的状态 分别列出2张表里这个字段的状态
      

  2.   


    SQL> select * from temp1;ID NAME       MONTH MONEY
    -- ---------- ----- -----
     1 11             1    10
     2 22             1    10
     3 11             2    20
     4 22             2    20
     5 11             3    30
     6 22             3    306 rows selectedExecuted in 0.015 secondsSQL> select * from temp2;CHENG1 CHENG2 CHENG3 NAME
    ------ ------ ------ ----------
        12     11     10 name1
        34     11     10 name2
        13     11     10 name3Executed in 0.015 secondsSQL> select a.*,b.* from temp1 a,temp2 b where a.name = b.cheng2 and a.money <> b.cheng3;ID NAME       MONTH MONEY CHENG1 CHENG2 CHENG3 NAME
    -- ---------- ----- ----- ------ ------ ------ ----------
     3 11             2    20     12     11     10 name1
     5 11             3    30     12     11     10 name1
     3 11             2    20     34     11     10 name2
     5 11             3    30     34     11     10 name2
     3 11             2    20     13     11     10 name3
     5 11             3    30     13     11     10 name3
    可以的嘛,我这没问题的阿