select a.*,b.col002 as col003
from a join b on a.col002=b.col001

解决方案 »

  1.   

    select a.col001,a.col002,b.col002 from 表a a join 表b b on a.col002=b.col001
      

  2.   

    select a.*, b.col002 as col003
    from a
    left outer join b
    on a.col002=b.col001
      

  3.   

    select a.col001,a.col002,b.col002 as col003
    from 表a a join 表b b on a.col002=b.col001
      

  4.   


    select a.*,col003=b.col002
    from 表a a
    left join 表b b on a.col002=b.col001
      

  5.   

    select a.col001,a.col002,b.col002 
    from 
    a a ,b b
    where a.col002 = b.col001 
    我不清楚我产效率会不会比楼上的差,但我觉得这样写已经可以了
      

  6.   

    --要分两步--添加字段
    alter table 表a add col003 varchar(50)
    go--复制数据
    update 表a set col003 =b.col002
    from 表a a join 表b b on a.col002=b.col001