SQL Server多表多列更新
student表:
lag表:
要求将student表stu_id列为1的stu_nick列和stu_phont列的数据更新为lag表的lag_nick列和lag_phone列.
SQL语句:
update s
set s.stu_nick=o.lag_nick,s.stu_phone=o.lag_phone
from Student as s
join lag as o
on o.lag_id=s.stu_id
where o.lag_id=1