0

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 ??

2
  • 1
    How are tables A and B related? Commented Jan 31, 2012 at 14:56
  • and how do they relate to table C Commented Jan 31, 2012 at 15:00

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0
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.

1 Comment

where condition for both the tables are different.. Than how to approach?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.