假设两表字段名依次为 a1,b1,c1,d1
inser b select * from a where a.a1<>b.a1 and a.b1<>b.b1 and a.c1<>b.c1 and a.d1<>b.d1

解决方案 »

  1.   

    假设两表字段名依次为 a1,b1,c1,d1
    inser b select * from a where a1 not in(select a1 from b)
    行否?
      

  2.   

    假设两表字段名依次为 a1,b1,c1,d1
    inser b 
    select * from a 
    where not exists (
    select 1 from b 
    where a.a1=b.a1 and a.b1=b.b1 and a.c1=b.c1 and a.d1=b.d1
    )
      

  3.   

    insert into b
    select * from a where id not in  (select id from b)orinsert into b
    select * from a where not exists(select 1 from b  where a.id = b.id)