oracle通过两张表的一个字段对应,update其中一张表的某个字段
2013-07-17 15:26
330 查看
A、B两张表,通过关联字段A1=B1,复制B表字段B2中数据到A表A2中
写成如下
参考自http://www.2cto.com/database/201304/202364.html
update A a set a.A2 = (select b.B2 from B b where b.B1=a.A1) where exists (select 1 from B where B.B1=a.A1)
写成如下
update A a set a.A2 = (select b.B2 from B b, A c where b.B1=c.A1) where exists (select 1 from B where B.B1=a.A1)则是从两个表交叉集合取值,错误结果
参考自http://www.2cto.com/database/201304/202364.html
相关文章推荐
- 联合两张具有主外键关系的表,想把其中一张表的字段值update到另外一张表中某个字段
- oracle 一张表一个字段用逗号隔开,另一张表中的一个字段要匹配
- 利用sqlite创建一个数据user,其含有一张表person,该person表中含有三个列,其中第一字段为主键int类型的,其他两个字段自定义数据类型和名称。
- oracle把一个表的字段更新到另一张表中
- 10_9_1编写代码,定义一个基类MyClass,其中包括虚礼方法GetString(),这个方法返回存储在受保护字段myString中的字符串,该字段可以通过只写公共属性ContainedStrin
- oracle 如何将一个表的某个字段赋值给另一张表的某个字段
- sql语句问题 通过联立两个表更新其中一个表的字段
- 向表中插入一条多个字段的数据,其中一个字段是从另一张表中获得的,其余字段是自己的
- Oracle两张表关联批量更新其中一张表的数据
- oracle数据库一个表字段中存了id,并以逗号分隔,id对应的详细信息在另一个表中
- Oracle用一个表的一个字段值去更新另一张表的某个字段值
- oracle将一个表中的某个字段的值,同步到另外一张表的某个字段中
- 5月21日 (对应数据库里的字段通过dropdownlist.SelectItem),那么对应查一个总数呢
- oracle 用一个表的多个字段更新另一个表对应的多个字段
- sql语句问题 通过联立两个表更新其中一个表的字段
- Oracle一张表中实现对一个字段不同值和总值的统计(多个count)
- Oracle中通过存储过程,Function,触发器实现解析时间类型的字段并插入的对应的数据表中
- sqlserver/oracle当插入表数据时同时修改其中一个字段的触发器
- Oracle用一个表的列更新另一个表对应记录的列,一不小心有字段就更新为空了
- oracle分组后合并其中一个字段