我需要一些创建更新查询的帮助。例如,我有
select:(T1- table 1, T2- tables 2, Z1 -column from table 1, Z2 Column from table 2 etc)
Select * from T1,T2 where X1=X2 and Y1=Y2 and Z1=Z2 and Datea>=20160601 and Dateb<20160720 and B1=2 and C1=5 and D1=10 and E2 in (A+,A-, 22,33,44)
现在我想写一个使用参数<{p>的update
from where
update T1 set F1, G1 where
如何写出正确的条件?
答案 0 :(得分:0)
update T1 set F1=10, G1=50
where exist (Select F1, G1
from T1,T2 where X1=X2
and Y1=Y2 and Z1=Z2
and Datea>=20160601
and Dateb<20160720
and B1=2
and C1=5
and D1=10
and E2 in (A+,A-, 22,33,44))
Youi必须选择需要在select子句中更新的列。
还要先尝试运行select语句,看看你是否得到了想要的结果