我把t2表中的数据倒入t1表,由于t2表第天在产生数据,所以我每天早上将t2中新产生的数据倒入t1怎么,也就是以前t1中已经有一部分t2数据,这次只倒t1中没有的(注,表结构相同)

解决方案 »

  1.   

    insert into 表1 select * from 表2 where 表2.id not in(select id from 表1)
      

  2.   


    insert into t1 select * from t2 where t2.id not in(select id from t1)
      

  3.   

    服务器: 消息 8101,级别 16,状态 1,行 1
    仅当使用了列的列表,并且 IDENTITY_INSERT 为 ON 时,才能在表 '订单总表' 中为标识列指定显式值。我的SQL语句:insert into 订单总表 select * from 订单总表时 where 订单总表时.订单号  not in (select  订单号 from 订单总表)订单号,为主键
      

  4.   

    最好用一时间字段来比较,再用一表保存insert 时的时间。