我正在使用MySQL数据库。

据说我有3张桌子。

Table A : column ida
Table B : column idb
Table C: column A,B


我想编写一个单据,通过它我可以将表A和表B中的值插入表C中?

最佳答案

应该是这样的

insert into tablec
select a.ida, b.idb
from tablea a
inner join tableb b on -- relation between tablea and tableb


但是您必须完成在表之间插入关系。

关于mysql - MySQL在一个查询中的一个表中插入多个表中的值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9081623/

10-12 12:50
查看更多