现有A和B两个表,如何把A表中存在而B表中不存在的记录复制到B表中。

解决方案 »

  1.   

    insert into b 
    select * from a where id not in (select id from b)
      

  2.   

    insert into b(field1,field2,field3..) 
    select (field1,field2,field3...) from a where 关键字段 not in (select 关键字段 from b)
      

  3.   

    select * from b union select * from a
      

  4.   

    再问
    A表
    刊名       卷期
    故事会      1
    故事会      2
    故事会      3
    中国文艺     1
    中国文艺     2
    中国文艺     3
    深圳青年     1
    深圳青年     2
    深圳青年     3
    中国人      1
    中国人      2
    中国人      3 B表
    故事会      1
    中国人      2
    如何把B表中没有的A表中数据拷到C表(结构相同)中。
      

  5.   

    用minus
    insert into c (select * from b minus select * from a)
      

  6.   

    Me.Data4.Database.Execute "insert into cqover select * from cq minus select * from jidao" 
    提示FROM字句错误。
    insert into cqover (select * from cq minus select * from jidao)
    提示sql语法错误。
      

  7.   

    你用的是哪种数据库,如果是用sql-server或oracle应能行,估计你用的是其它的数据库