一个表的字段值按另一个表的值进行更新
表 a
字段:ptype, uname ,unint ,barcorde
表 b
字段:type, uname ,fullname,barcorde
2两表靠b.type=a.ptype 进行关联。
职何让 把表b中的表barcorde值更新到 a表中.barcorde字段中
update peUnit set a.BarCode=b.barcode FROM peUnit a,ptype b where a.PtypeId=b.typeId AND a.nUnit=1
update peUnit set a.BarCode=b.barcode FROM T_Jxc_PtypeUnit a JOIN ptype b on a.PtypeId=b.typeId where a.nUnit=1
都不行,提示
消息 4104,级别 16,状态 1,第 1 行
无法绑定由多个部分组成的标识符 "a.BarCode"。
本人SQL基础差,请高手帮忙写一下正确的SQL更新语句。