This is may sample database
TABLE A-----> TABLE B <-----TABLE C
The arrows show the relationship
TABLE A
{
tblA_col1 <----primary key
}
TABLE A
(tblA_col1)
| A_1 |<----data
TABLE C
{
tblC_col1 <----primary key
}
TABLE C
(tblC_col1)
| C_1 |<----data
| C_2 |
| C_3 |
TABLE B
{
tblB_col1 <----primary key
tblA_col1 <----col from table A
tblC_col1 <----col from table C
}
TABLE B
(tblB_col1 | tblA_col1 | tblC_col1)
| B_1 | A_1 | C_1 |
| B_2 | A_1 | C_2 |
| B_3 | A_1 | C_3 |
Now my problems is how to insert the data in TABLE B
with just one query?