互联网服务数据库update

update用法

如何将a表中的b字段赋值给c表的d字段  c.d=a.b,求解
参与8

7同行回答

linux123linux123数据库管理员郑州银行
恩,支持楼上的显示全部
恩,支持楼上的收起
互联网服务 · 2011-12-16
浏览474
TUBER727TUBER727数据库开发工程师DB2
update a set a.字段=(                     select b.字段 from b                   where a.key=b.key) where a.key in (sel...显示全部
update a set a.字段=(                     
select b.字段 from b                  
where a.key=b.key) where a.key in (select b.key  from b where a.key=b.key)  
问题已解决,同类问题可以参考一下:)收起
互联网服务 · 2011-12-08
浏览479
jimmyjimmy数据仓库工程师招行软件中心
update c set d = (    select b from a where a.x = c.x)where exists  (    select b from a where a.x = c.x)显示全部
update c set d = (
    select b from a where a.x = c.x
)
where exists  (
    select b from a where a.x = c.x
)收起
银行 · 2011-12-06
浏览529
TUBER727TUBER727数据库开发工程师DB2
我要更新很多条  我要将a中的b字段和c表中的d字段table a                  table cb      x                 &n...显示全部
我要更新很多条  我要将a中的b字段和c表中的d字段
table a                  table c
b      x                     d      x
       1                             1
       2                             2
       3                             3
update c set d=(select b from a where ?) where x in()
我要分别把c表中x=1,2,3对应的d的值赋给a表中x=1,2,3对应的b值
单条更新的我已会写,感谢1,2,3楼的回复。
请高手指点 关联性如何写?收起
互联网服务 · 2011-12-06
浏览498
jimmyjimmy数据仓库工程师招行软件中心
update c set d = (  select b from a where 关联)where 更新范围显示全部
update c set d = (
  select b from a where 关联
)
where 更新范围收起
银行 · 2011-12-05
浏览470
wp28556259wp28556259软件架构设计师CMBC
回复 2# macrozeng     写反了。。是update c set c.d=(select a.b from a)显示全部
回复 2# macrozeng


    写反了。。是update c set c.d=(select a.b from a)收起
银行 · 2011-12-05
浏览480
macrozengmacrozeng数据库管理员IBM
如果 d 表只有一条数据的话update a set a.b=(select c.d from d)显示全部
如果 d 表只有一条数据的话
update a set a.b=(select c.d from d)收起
政府机关 · 2011-12-05
浏览473

提问者

TUBER727
数据库开发工程师DB2
擅长领域: 数据库

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2011-12-05
  • 关注会员:1 人
  • 问题浏览:4263
  • 最近回答:2011-12-16
  • X社区推广