首先,你的问题就问的前后矛盾,标题描述是用A表某个字段更新B表的字段,举例子时又说用B表的qiantity更新A表的newqiantity?
假设A表有字段bnum和newqiantity,B表有字段bnum和qiantity,用B表的qiantity值更新对应的A表中的newqiantity值。以Oracle数据库为例:SQL语句如下:
update A set (newqiantity)=(select qiantity from B where A.bnum=B,bnum)
你在建表的时候,建立好这2个表之间的关系..我记得有3中选择...就是另外一个表的更新是否影响到和它关连的表.,
update
(select A.bnum ,A.newqiantity,B.qiantity from A left join B on A.bnum=B.bnum) AS C
set C.newqiantity = C.qiantity
where C.bnum =XX
update A set newqiantity =
(select qiantity from B where A.bnum = B.bnum)
update a set a.newqiantity=b.qiantity FROM A a left join B b on a.bnum=b.bnum