lxpeng163
作者lxpeng163·2013-07-05 19:53
项目经理·哈尔滨银行

DB2一个表数据更新另一个表

字数 280阅读 1372评论 0赞 0
我想用一个例子来说明db2 update的使用
aa(id,qty) ,bb(id,qty,loc_id(货架号))两个表.目的是把aa.qty=bb.qty 
db2 update aa set qty=(select qty from bb where bb.id=aa.id and bb.loc_id=9) where exists (select 1 from bb where bb.id=aa.id and bb.loc_id=9)

使用select ..........where............. limit 1
试吧
只返回一条记录

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论0 条评论

Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广