UPDATE t3
SET t3.QTY=t1.GS
FROM t1,t2,T3
WHERE T1.ID=T3.ID AND T1.ID=@ID1
AND T2.ORDER_ID=T3.ORDER_ID AND T3.ORDER_ID=@ORDER_ID1
AND T2.ORDER_RTK=T3.ORDER_RTK AND T3.ORDER_RTK=@ORDER_RTK1
AND T1.GS<>0
AND T3.TPYE='2'
INSERT INTO t1 (id,SOURCE_ID,GS,QYT) VALUES ('a1','f2','20','100')
INSERT INTO t2 (ID,SOURCE_ID,ORDER_ID,ORDER_RTK,QTY_1,TPYE,qty) VALUES ('a1','f2','s201606','cc22','88','2','99')
INSERT INTO t3 (ID,ORDER_ID,ORDER_RTK,QTY_1,TPYE,qty) VALUES ('a1','s201606','cc22','88','2','99')
更新T2:a1=a1,f2=f2,gs=100,tpye='2',条件符合,
更新T3:a1=a1,s201606=s201606,cc22=cc22,gs=100,tpye='2',条件也符合,
应该2个表都会更新阿。
SET t3.QTY=t1.GS
FROM t1,t2,T3
WHERE T1.ID=T3.ID AND T1.ID=@ID1
AND T2.ORDER_ID=T3.ORDER_ID AND T3.ORDER_ID=@ORDER_ID1
AND T2.ORDER_RTK=T3.ORDER_RTK AND T3.ORDER_RTK=@ORDER_RTK1
AND T1.GS<>0
AND T3.TPYE='2'
INSERT INTO t1 (id,SOURCE_ID,GS,QYT) VALUES ('a1','f2','20','100')
INSERT INTO t2 (ID,SOURCE_ID,ORDER_ID,ORDER_RTK,QTY_1,TPYE,qty) VALUES ('a1','f2','s201606','cc22','88','2','99')
INSERT INTO t3 (ID,ORDER_ID,ORDER_RTK,QTY_1,TPYE,qty) VALUES ('a1','s201606','cc22','88','2','99')
更新T2:a1=a1,f2=f2,gs=100,tpye='2',条件符合,
更新T3:a1=a1,s201606=s201606,cc22=cc22,gs=100,tpye='2',条件也符合,
应该2个表都会更新阿。