有a(id,sn,name)
b(aid,sn)现在想更新b表的sn列,使b表中的sn等于a表的sn
update b,a set b.sn=a.snwhere b.aid=a.id不知道为什么这样不行,请高手指定,多谢
b(aid,sn)现在想更新b表的sn列,使b表中的sn等于a表的sn
update b,a set b.sn=a.snwhere b.aid=a.id不知道为什么这样不行,请高手指定,多谢
调试欢乐多
from a,b
where b.aid=a.id
update b
set b.sn=a.sn
from a
where b.aid=a.id
见楼上
也可以用inner join
update b set b.sn=a.sn from a inner join b on b.aid=a.aid
update b
set b.sn=a.sn
from a
where b.aid=a.id