VB+SQL Server7.0,有两个表,假设为table1和table2,都包含下面三个字段:
pos1(float),pos2(float),date(char)
table1中的pos1和pos2是没有数据的,我想把table2中的这两个字段的数
据倒入到table1中来,条件是根据两个表中的date的值来对应,如表1:
pos1   pos2    date
NULL   NULL    2003-2-4表2:
pos1   pos2      date
203.3  12.345   2003-2-5 
201.3  2.345    2003-2-4上面就是要把table2的第二条记录中的pos1和pos2的值更新到table1中
SQL语句怎么写?应该是update吧,但我VB不太熟

解决方案 »

  1.   

    update table1 set table1.pos1=table2.pos1,table1.pos2=table2.pos2 from table1 inner join table2 on table1.date=table2.date
      

  2.   

    update table1 inner join table2 on table1.date=table2.date set pos1=table2.pos1,pos2=table2.pos2
      

  3.   

    update table1 set table1.pos1=table2.pos1,table1.pos2=table2.pos2 from table1,Table2 where table1.date=table2.date
      

  4.   

    udpate a set a.pos1=b.pos1,a.pos2=b.pos2
    from table1 as a,table2 as b
    where a.date=b.date
      

  5.   

    udpate a set a.pos1=b.pos1,a.pos2=b.pos2
    from table1 as a,table2 as b
    where a.date=b.date