日期:2014-05-18 浏览次数:20535 次
UPDATE tb1 SET name=(SELECT name FROM tb2 WHERE tb2.id=tb1.id,tb2.yy=tb1.yy,tb2.wk=tb1.wk) ,phone=(SELECT phone FROM tb2 WHERE tb2.id=tb1.id,tb2.yy=tb1.yy,tb2.wk=tb1.wk) ,addres=(SELECT addres FROM tb2 WHERE tb2.id=tb1.id,tb2.yy=tb1.yy,tb2.wk=tb1.wk) ,email=(SELECT email FROM tb2 WHERE tb2.id=tb1.id,tb2.yy=tb1.yy,tb2.wk=tb1.wk) -- -- -- --后面还七八个都要=(SELECT *** FROM tb2 WHERE tb2.id=tb1.id and tb2.yy=tb1.yy and tb2.wk=tb1.wk)
update a set col1=b.col1, col2=b.col2, col3=b.col3 from tb1 as a join tb2 as b on a.xx=b.xx and a.xxx=b.xxx and a.xxxx=b.xxxx
------解决方案--------------------
update a set name=b.name,phone=b.phone... from tb1 a join tb2 b on a.id=b.id and a.yy=b.yy and a.wk=b.wk