如何把表1的a字段值符给表2的b字段
sql怎默写??

解决方案 »

  1.   

    update tb2
    set b = a.a
    from tb2 b,tb1 a
    where a.id = b.id
      

  2.   


    update 表2
    set b = 表1.a
    from 表2,表1
    where 表2.关键字=表1.关键字
      

  3.   

    insert into tb2 (b)
    select a from tb1
      

  4.   

    update tab2 Set b=a from tab1,tab2 where tab1.a= tab2.a
      

  5.   

    insert与update那个好些,如果数据量比较大
      

  6.   

    insert与update那个好些,如果数据量比较大.
    如果是多个字段负值,是不是
    insert into tb2 (b)
      ([b]
      ,[c]
      ,[d]

    select [a]
          ,[e]
          ,[f]
    from tb1
    是否表1的a,e,f字段就分别符给表2的b,c,d字段
     
      

  7.   

    如果是多个字段负值,是不是 
    insert into tb2 (b) 
      ([b] 
      ,[c] 
      ,[d] 
    )  
    select [a] 
          ,[e] 
          ,[f] 
    from tb1 
    是否表1的a,e,f字段就分别符给表2的b,c,d字段 0-------------------是的
      

  8.   

    update b set b.b=a.a from 表1 a join 表2 b on ?=?
      

  9.   

    如果表2 的某列去更新表1的某列,并且表1存在这条记录,那就用update如果表1根本不存在这条记录,那就只能insert啦