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 ??
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 ...
I'm assuming that C has only tow columns and they are of same datatype as that of id1 and id2 from tables A and B. I hope you get the idea.