当前位置: 代码迷 >> Sql Server >> 多条update语句
  详细解决方案

多条update语句

热度:103   发布时间:2016-04-27 13:39:40.0
求一个多条update语句
表A
id name url
1 a aa.com

表B
id aid name url
1 a aa.com

想要把表B中 name和url都等于表A中记录的aid赋值为表A中的id

------解决方案--------------------
SQL code
update Bset aid=a.IDfrom Awhere a.Name=b.Name and a.Url=b.Url
------解决方案--------------------
update B set B.aid=A.id from A where B.name=A.name and B.url =A.url
  相关解决方案