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 tbjmjkda a set a.jgbm=b.SJJGBM from tbyljg b where a.JGBM=B.JGBM AND b.jglx like '%下属科室%'

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 表名 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(...

UPDATE bSET 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.id = 5 ...

update 表2 set 发表=1 where aid =(select id from 表1 where 表1.id =表2.aid and 表1.转化状态=1)

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

用别名 update a set a.unitname=data_upload.unitname from servera.flgl_db_210500.dbo.data_upload_1 AS a,Data_Upload where Data_Upload.industry_type= a.industry_type

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

网站地图

All rights reserved Powered by www.5213.net

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