www.5213.net > SQL2005跨表upDAtE的问题

SQL2005跨表upDAtE的问题

update a set a.c=b.d from aa a, bb b where a.a = b.b 或者 update aa set c = (select top 1 d from bb where aa.a=bb.b)

update a set a.pic=b.pic where a.title=b.title 即可,不用那么复杂吧. 不好意思,漏写了from语句,完整的写法是: update a set a.pic=b.pic from a,b where a.title=b.title 即可,不用那么复杂吧.

update A set A.shl = A.shl - B.shl from retmxls A,daysphz B where A.spid = B.spid and A.fdbs = B.fdbs and A.rq = B.rq and A.ontime > '17:37:18' and A.shky = '002' and A.fdbs = 'HKD' 这个是SqlServer的语法

UPDATE b SET b.Com_introduce = a.company_intro --这里改改 FROM australia.dbo.companytest as a, yimingong.dbo.company as b WHERE (a.id = 2 AND b.Com_Id = 1) OR (a.id = 14 AND b.Com_Id = 2) OR (a.id = 18 AND b.Com_Id = 3) OR (a.i...

试试这个 update 表名 a set a.vin_code = (select b.vin_code from (select vin_code_s,vin_code from 表名 where id in (select max(id) from 表名 group by vin_code_s)) b where a.vin_code_s=b.vin_code_s) where a.id not in (select max(...

更新查询,不同的数据库之间的语法差别一般都比较大。 下面按MSSQL修改如下: update TF_PSS_Z set TF_PSS_Z.BC=b.Qty-a.Qty from TF_PSS a,TF_CK b ,TF_PSS_Zwhere a.PRD_NO=b.PRD_NO and a.PS_NO=TF_PSS_Z.PS_NO;ACCESS或MySQL可以简化一些: ...

这两个数据库在同一个服务上吗? 在的话就简单了. insert into 数据库b..表b(name) select name from 数据库a..表a where 数据库a..表a.name not in (select 数据库b..表b.name from 数据库b..表b)

update T2 set 要更新的字段 = T1.对应的字段--可以输入多个用逗号分开 from T1 where T2.ID = T1.ID

update a set a.column1 = b.column1 from table a,table2 b,table3 c where a.id=b.id and a.id = c.id and c.id > 100 类似这个,你按照你的要求写出语句吧

update 表1 set balance=balance+amount from 表2 where 表2.cardnumber='111111' and 表2.cardclose= '111111' and 表2.estate='可充值' and 表1.account='1111111111111111111' and 表1.estate='正常' 按你的写法,表2条件不成立,子查询取出...

网站地图

All rights reserved Powered by www.5213.net

copyright ©right 2010-2021。
www.5213.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com