现有如下两张表:
TABLE T1                     TABLE T2LabelIndex                   LabelIndexL0098                        L0025
L0097                        L0024
L0096                        L0023
.                            .
.                            .
.                            .
L0001                        L0001现在需要比较T1和T2将T2中没有T1的那部分数据拷贝至T2.注:T1每天都在更新

解决方案 »

  1.   

    insert into t2
      select * 
       from t1 where not exists(select 1 from t2 where t1.LabelIndex=t2.Labelindex)
      

  2.   

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

  3.   

    比较学术派的写法,
    insert   into   t2   select   *   from   t1   where   t2.LabelIndex   not   in   (select   LabelIndex   from   t1)数据同步问题,每天去取前一天的数据同步,还是实时的呢。