这个update怎么写啊?

aaajj aaajj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

create table aa(a number, b number, c number)
create table bb(a number, b number, c number)

aa
a b c
1 0 0
2 0 0
3 0 0


bb
a b c
1 1 1
2 2 2
3 3 3
4 4 4
现在要根据aa中的a字段和bb中的a字段来更新aa的数据,得到
a b c
1 1 1
2 2 2
3 3 3

我想到了这种方法,但是不好,重复了
update aa ta set ta.b = (select b from bb where ta.a = a),ta.c = (select c from bb where ta.a = a)

大家帮忙看看
...全文
评论 8
收藏 已收藏
分享
返回顶部
aaajj
基础和管理 17,379 成员 95,111 内容