gbcr.net
当前位置:首页 >> upDAtE A sEt From >>

upDAtE A sEt From

不知道你这是什么数据库 Sql server: update a set a.c3=b.c3 from ( select b.c1 + b.c2 as bb , c3 from b ) as b , a where b.bb = a.c1 + a.c2 Oracle update a set a.c3=b.c3 where a.c1||a.c2 in (select a.c1||a.c2 from a,b where a.c1...

update A set name = '小张' where age

什么数据库?不同数据库的语法不同

你的意图是什么,你这语法有错误, update 后面不能跟from ,你若想把表a的某字段更新为表b对应的字段值的话 ,如下, update 表A set A.字段 =(select B.字段 from 表B where 表B.主键=表A.主键);

把 update table1 set A=(select A from table2 where B=table1.B) 改成 update table1 set A=NVL((select A from table2 where B=table1.B),VALUE); 当select A from table2 where B=table1.B 得到null值的时候,强制把null改成 VALUE(你自己根...

update table t1 set (t1.b, t1.c) = (select t2.b1, t2.c1 from table1 t2 where t1.a = t2.a1) where exists (select 1 from from table1 t2 where t1.a = t2.a1)

想办法保证赋值唯一就行了,否则聚合函数不能做UPDATE更新 如果select b.id from B b group by b.name中每一个b.name只有唯一一个b.id那么就可以 update A a set a.id = (select DISTINCT b.id from B b where a.name=b.name) 试试

update B set B.name=A.name from A,B where B.id=A.id and B.type=1

update A set qty=B.qty from A,B where A.id=B.id

UPDATE FROM 好像是 MSSQL 特有的 其他的 ACCESS, MYSQL , ORACLE 应该写成 UPDATE tableA, tableB SET a = b WHERE tableA.c = tableB.c

网站首页 | 网站地图
All rights reserved Powered by www.gbcr.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com