delete from b
where IID IN
(
Select B.IID 
from A,B 
where A.NID=523 and A.NID=B.NID and A.Ph_no<>B.Ph_no
)
不知道是不是要删除这些东西,给的例子太模糊了。

解决方案 »

  1.   

    有两个表
    表一:A
    IID         NID         Ph_no       
    7099        523         555         
    表二:B
    IID         NID         A_IID   Ph_no    
    19485       523         7099        555   
    19484       523         7099        583   用发下方式如何删除这条记录
    IID         NID         A_IID   Ph_no    
    19484       523         7099        583   delete from b
    where NID = 523 (只能给出这个条件)
    and (A.ph_no=B.ph_no)
      

  2.   

    delete from A,B
    where B.NID = 523 and (A.ph_no=B.ph_no)
      

  3.   

    delete from b
    where NID = 523 (只能给出这个条件)
    and    ph_no not in (select a.ph_no from a,b where a.nid=b.nid )
      

  4.   

    看错了,不好意思,同意 micha_he(不会就学)
      

  5.   

    delete from b  where IID not IN
    (  Select b.IID from A,B 
       where and A.NID=B.NID and A.Ph_no=B.Ph_no
     )
      

  6.   

    只能给一个明确的条件 NID = 523
      条件是这样的 A.IID = b.NID   and  a.NID = b.A_IID  and  a.Ph_no = b.Ph_no
      表B中不满足的记录删除
      

  7.   

    delete from b
    where b.nid=523 and (b.ph_no <> (select a.ph_no form a where a.iid=b.a_iid))