表1有三个字段:AuthorizedCode,TrocheType,Standard.有7000条数据,这张表是用来替换表2的TrocheType和Standard列.
AuthorizedCode字段是起标识列的作用做为where条件使用的.该怎么写?

解决方案 »

  1.   

    select b.*,a.* from
    from t1,t2 where t1.AuthorizedCode=t2.AuthorizedCode
      

  2.   

    insert into 表2(TrocheType,Standard) select TrocheType,Standard from 表1 where AuthorizedCode...
      

  3.   

    insert into 表2(TrocheType,Standard) select TrocheType,Standard from 表1 where ....后面加你需要的条件
      

  4.   


    update 表2
    set TrocheType=b.TrocheType,
    Standard=b.Standard
    from  表1 b,表2 a
    where a.AuthorizedCode=b.AuthorizedCode
    ??
      

  5.   

    update 
      t2
    set 
      t2.TrocheType=t1.TrocheType,
      t2.Standard=t1.Standard
    from
      t1,t2
    where
      t2.AuthorizedCode=t1.AuthorizedCode
    ?
      

  6.   

    update 表2 set TrocheType=b.TrocheType,Standard=B.Standard from 表2 a,表1 b
    where a.AuthorizedCode=b.AuthorizedCode
      

  7.   

    update 表2
    set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard
    from 表1
    where 表2.AuthorizedCode = 表1.AuthorizedCode是这个意思吗?
      

  8.   

    create table 表1(AuthorizedCode int,TrocheType int,[Standard] int)
    insert into 表1 select 1,58,399
    insert into 表1 select 2,348,48
    create table 表2(AuthorizedCode int,TrocheType int,[Standard] int,colother int)
    insert into 表2 select 1,33,385,66
    insert into 表2 select 2,858,85,77
    go
    update 表2 set trochetype=b.trochetype,standard=b.standard from 表2 a inner join 表1 b on a.authorizedcode=b.authorizedcode
    go
    select * from 表2
    go
    drop table 表1,表2
    /*
    AuthorizedCode TrocheType  Standard    colother
    -------------- ----------- ----------- -----------
    1              58          399         66
    2              348         48          77
    */
      

  9.   

    1:update 表2
    set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard
    from 表1
    where 表2.AuthorizedCode = 表1.AuthorizedCode 2:update t2
    set  TrocheType =(select TrocheType from 表2 where AuthorizedCode=t2.AuthorizedCode),
    Standard =(select Standard from 表2 where AuthorizedCode=t2.AuthorizedCode)
    from 表2 t2