Home
Sign Up
Sign In
V2EX
›
问与答
mysql 如何查询 a 表中所有的 id 并写入 b 表数据
kaiki
·
Dec 22, 2020
· 1049 views
This topic created in 1966 days ago, the information mentioned may be changed or developed.
就写入 id 就行,之后弄个触发器让它新增自动写入好了。
可以的话跳过已存在的 id 数据
写入
触发器
MySQL
数据
2 replies
1
kaiki
OP
Dec 22, 2020
算了,想起来了
insert into b(m_id) select id from a where id not in(select id from b);
2
kaiki
OP
Dec 22, 2020
@
kaiki
打错了
insert into b(id) select id from a where id not in(select id from b);
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
977 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 23ms ·
UTC 20:35
·
PVG 04:35
·
LAX 13:35
·
JFK 16:35
♥ Do have faith in what you're doing.
❯