【更新 a,b 表中 的字段d 为 e 当满足 c表中的一个条件时】
请问这样的 sql 怎么写
一个sql的问题:假设有 表 a,b,c ; d为 a,b 表中 相同名称的一个字段 ; e为目标值
答案:2 悬赏:50 手机版
解决时间 2021-02-19 00:54
- 提问者网友:凉末
- 2021-02-18 06:28
最佳答案
- 五星知识达人网友:往事埋风中
- 2021-02-18 08:02
今儿百度发SQL语言提交不了!我给你留言了!
update
(
select * from (select * from a left jion b on a.d=b.d) b
union all
select * from c
) t
set t.d=修改内容 where t.(原来在C的某个字段)满足条件
更正一下
update a set a.d=e where a.id(主键) in
(
select t.id from
(
select * from (select * from a left jion b on a.d=b.d) b
union all
select * from c
) t where t.(原来在C的某个字段)满足条件
)
修改b表d字段的方法相同
update
(
select * from (select * from a left jion b on a.d=b.d) b
union all
select * from c
) t
set t.d=修改内容 where t.(原来在C的某个字段)满足条件
更正一下
update a set a.d=e where a.id(主键) in
(
select t.id from
(
select * from (select * from a left jion b on a.d=b.d) b
union all
select * from c
) t where t.(原来在C的某个字段)满足条件
)
修改b表d字段的方法相同
全部回答
- 1楼网友:woshuo
- 2021-02-18 09:03
你好!
update a set d=e where
希望对你有所帮助,望采纳。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯