1、先将表A里有而表B里没有的记录放在表C
2、再将表B里有而表A里没有的记录放在表C

解决方案 »

  1.   

    不需要存储过程,把两个INSERT放在同一事物处理就可以了。
    insert into c as select * from a where a.id not in(select id from b)
    insert into c as select * from b where b.id not in(select id from a)
      

  2.   

    insert into C select * from A where A.id not in (select B.id from B);insert into C select * from B where B.id not in (select A.id from A);
      

  3.   

    大概是这样的吧:
    insert c (select * from a where a.* not in(select * from b))
    insert c (select * from b where b.* not in(select * from a))