I am using MySQL database.
Supposedly I have 3 table.
Table A : column ida
Table B : column idb
Table C: column A,B
I want to write a single through which I can insert values from Table A and Table B to Table C ??
It should be something like this
insert into tablec
select a.ida, b.idb
from tablea a
inner join tableb b on -- relation between tablea and tableb
but you'll have to finish inserting the relation between tables.
INSERT INTO C SELECT id1, id2 FROM A, B WHERE ...
我假设C只有两列,它们与表A和B中id1和id2的数据类型相同。我希望你能得到这个想法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.