同一个数据库下,表archives有字段(id,...,xl),表shop(aid,...,xl),2个表都有数据,表archives的id包括但比表shop的aid数据要多,要把shop表的xl字段复制到archives表的xl字段,语句如何写,请教高人!
这样不行~!
UPDATe archives SET xl = xl FROM shop WHERe shop.aid = archives.id
分不多,给20了,好的话追加
Mysql复制一个字段到另个表,要求id相同
答案:3 悬赏:10
解决时间 2021-12-30 18:49
- 提问者网友:紫柔同归
- 2021-12-30 06:40
最佳答案
- 二级知识专家网友:单身小柠`猫♡
- 2021-12-30 07:41
UPDATE archives,shop SET archives.xl = shop.xl WHERe shop.aid = archives.id
正确答案
正确答案
全部回答
- 1楼网友:走,耍流氓去
- 2021-12-30 10:25
update archives a
set xl=(select xl from shop b where b.aid=a.id and rownum = 1)
where a.id in(select id from archives)
- 2楼网友:万千宠爱
- 2021-12-30 09:00
insert into c(单位) select 单位 from a
思路就是用insert into select 句型实现搬表
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯