update b set b.d=a.d,.. from a inner join b on a.a=b.a and a.b=b.b and a.c=b.cinsert into b select a.* from a left join b on a.a=b.a and a.b=b.b and a.c=b.c where b.a is null

解决方案 »

  1.   

    一个SQL语句完成不了:update 
        B 
    set
        d = a.D
    from
        B,
        A
    where
        B.a=A.a and B.b=A.b and B.c=A.c
    insert into B 
    elect * from A where not exists(select 1 from B where a=A.a and b=A.b and c=A.c)
      

  2.   

    update b set b.d=a.d from b,a where a.a=b.a and a.b=b.a and a.c=b.c
    insert into b select * from a where exsits (select * from b where a.a=b.a and a.b=b.a and a.c=b.c

    没具体测试过,但这样应该可以的
      

  3.   

    恩 但是 为什么  我用 select *  from A where not exists(select 1 from B where a=A.a and b=A.b and c=A.c)  直接在查询器里执行 怎么把A的数据都查出来了,应该查出来的是 A中没包含B的那些数据啊 怎么解释????????
      

  4.   

    update B 
    set d = a.D
    from   B
    Left Join  A
    On B.a=A.a and B.b=A.b and B.c=A.cinsert into B 
    Select * from A where not exists(select 1 from B where a=A.a and b=A.b and c=A.c)
      

  5.   

    有谁能解释下吗 select *  from A where not exists(select 1 from B where a=A.a and b=A.b and c=A.c)