把B表里的id,name字段数据复制到A表里. FID字段相关联。
update A set A.id = B.id,  A.name = B.name where A.FID = B.FID实际运行的时候报错
无法绑定由多个部分组成的标识符“B.FID”
好像我网上找了一下是要用别名(对B表)
怎么用

解决方案 »

  1.   

    update A set id = B.id, name = B.name from a , b where A.FID = B.FID
      

  2.   

    update A set A.id = B.id, A.name = B.name FROM B where A.FID = B.FID
      

  3.   

    update A set id=B.id,name=B.name from a,b where A.FID = B.FID
      

  4.   

    update A set id = B.id, name = B.name from a , b where A.FID = B.FID
      

  5.   


    update A set id = B.id, name = B.name from a , b where A.FID = B.FID
      

  6.   

    另外请教一下
    如何判断一个表里的字段数据是否唯一
    比如 A表里的ID字段,它里面有3万条数据,它不是主键,我如何判断该字段没重复数据呢?
      

  7.   

    --唯一
    select id from a group by id having count(1) = 1--不唯一
    select id from a group by id having count(1) > 1
      

  8.   


    update A 
    set A.id = B.id
        ,A.name = B.name
    from A
         ,B
    where A.FID = B.FID
      

  9.   

    update A set A.id = B.id, A.name = B.name FROM B where A.FID = B.FID
      

  10.   

    --唯一
    select id from a group by id having count(1) = 1--不唯一
    select id from a group by id having count(1) > 1
      

  11.   


    --唯一
    select id from a group by id having count(1) = 1--不唯一
    select id from a group by id having count(1) > 1up 9楼
      

  12.   

    update A 
    set id = B.id, name = B.name  from B where A.FID = B.FID
      

  13.   

    update A set id = B.id, name = B.name from a , b where A.FID = B.FID