select * from A where exists(select * from B)相同部分
select * from A where not exists(select * from B)不同部分
不会出错.

解决方案 »

  1.   

    2.假设表中有数据A,B,C,但是我现在仍然想要插入A,B,C这三条数据,会不会出错?要看表如何定义了
    比如你的某个字段是PK或者是UNIQUE的CONSTRAINT
    当然会出错
      

  2.   

    select * from A where exists(select * from B where 关联条件)2。要看是否有相关约束
      

  3.   

    insert a--插入a表
    select * from b where not exists
    (select 1 from a whree 列A=b.列A and 列B=b.列B.......)
      

  4.   

    1.问题描述不清楚,A,B两个表中有主键吗?都有什么字段啊,不了解这些怎么写查询啊
    2.看你的表的约束条件了,如果有主键,unique之类的约束是会出错的