楼主的意思是不是如果不在存储过程中怎么写?就是用这样的SQL语句不就可以了吗 update a set a.D = 1.5 * b.A from 表2 a, 表1 b where a.fid = b.fid
楼主的意思是UPDATE还是用UPDATE,但不用FROM 表1,表2 这样关联。 update s_pmtr set quantity=( select a.cqty*1.5 from s_pout a join s_pmtr b on b.pout=a.fid where a.cqty*1.5<>b.quantity and a.cqty<>0 and b.mtr='M041112992929642' order by ptime)我这样写也是一种方法,但我还没有写完整,不知还该如何改?请高手指点。
表1 :fid,a,b,c 表2 :fid,表1fid,d,e,f 现在是对表2 中的D字段为表1A字段乘以1。5倍UPDATE,但表2 的(表1fid)字段要与表1 的fid字段相等 update 表1 set B.D=A.A*1.5 from 表1 A,表2 B where A.fid=B.fid
update a
set a.D = 1.5 * b.A
from
表2 a,
表1 b
where
a.fid = b.fid
update s_pmtr set quantity=( select a.cqty*1.5 from s_pout a join s_pmtr b on b.pout=a.fid where a.cqty*1.5<>b.quantity and a.cqty<>0 and b.mtr='M041112992929642' order by ptime)我这样写也是一种方法,但我还没有写完整,不知还该如何改?请高手指点。
表2 :fid,表1fid,d,e,f
现在是对表2 中的D字段为表1A字段乘以1。5倍UPDATE,但表2 的(表1fid)字段要与表1 的fid字段相等
update 表1
set B.D=A.A*1.5
from 表1 A,表2 B
where A.fid=B.fid