请问一个简单的问题(急)

ygghost 2005-04-12 09:39:23
1 我想更新table1的mc等于mc+mc1
2 mc1 是table2里的字段
3 table1和 table2 用id关联
我这句不好用,哪位可以指点一下!字段都为字符型

update table1 set mc=mc+'select mc1 from table2 where table2.id=table1.iid'
...全文
160 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
pureboy5 2005-04-14
  • 打赏
  • 举报
回复
我的后面还有Where 条件的呀!!用来限制只有一条时更新
camelbox1978 2005-04-14
  • 打赏
  • 举报
回复
update table1 set mc=(select mc||mc1 from table1,table2 where table2.id=table1.iid)
where id = (select table1.id from table1, table2 where table1.id=table2.id)
Alkeen 2005-04-13
  • 打赏
  • 举报
回复
都是字符型就用字符串连接。
update table1 set mc = mc||(select mc1 from table2 where table2.id = table1.id)
chenchen2003 2005-04-13
  • 打赏
  • 举报
回复
update table1 set mc=mc+(elect mc1 from table2 where table2.id=table1.iid)

这个语句要成功执行也要自查询查出来的结果是一条记录
pureboy5 2005-04-13
  • 打赏
  • 举报
回复
哈哈,我想应该是这样的:
update talbe1 a set a.mc=(select b.mc1 from table2 b,table1 a where a.id=b.id) +a.mc where a.id in (select a.id from table1 a, table2 b where a.id=b.id)
hsj20041004 2005-04-13
  • 打赏
  • 举报
回复
你的思路就很好的
update table1 set mc=mc+(select mc1 from table2 where table2.id=table1.iid)

这个语句要成功执行也要自查询查出来的结果是一条记录
即mc1的记录为一条 !!
lfx_001 2005-04-12
  • 打赏
  • 举报
回复
唉,楼主怎么连‘’的功能都没有明白呀
yxxx 2005-04-12
  • 打赏
  • 举报
回复
update table1 set mc=mc+(select mc1 from table2 where table1.id=table2.id)

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧