A表:ID,name
B表:ID,name
在B表中如果没有这个ID,那么删除A表的这个ID数据

解决方案 »

  1.   

    1.用循环读出A 表的ID_A ,
    2. 借用局部变量保存ID_A .在B表中查找 ID_A,
    3.返回错误,。删除 ID_A .
    4.OK .
      

  2.   

    delete * from A where ID not exists in (select A.ID from A union B on A.ID=B.ID)没有实际执行,可能有些小错误。思路就是将A和B中ID相同的记录建一个试图,从A中删除ID不在这个视图中的记录即可^_^
      

  3.   

    delete from A where ID not exists (select * from B where id=a.id)
      

  4.   

    Sorry,上面的有点错误delete from A where not exists (select * from B where id=a.id)
      

  5.   

    access 数据库中
    delete * from A where not in (select * from B where id=a.id)
    sql server 中
    delete from A where not exists (select * from B where id=a.id)
      

  6.   

    delete from a where id not in (select id from b )
      

  7.   

    delete from a where id not in (select id from b )