title: SQL INSERT SELECT from Table2 to Table3
body: <p>I'm trying to insert ID from Table1 and Table2 into Table3.My table design is:</p>
  
  <pre><code>Table1:
  Id_Table1
  field1 etc.
  
  Table2:
  Id_Table2
  field1 etc.
  
  Table3:
  Id_Table3
  Id_Table1_FK
  Id_Table2_FK
  </code></pre>
  
  <p>I do this when I save records for Table1. Meanwhile I have Datagridview in my form, which uses comboboxcell to view records from Table2. When I select some record from Table2, both ID's (Table1 &amp; Table2) needs to be inserted into Table3. </p>
  
  <p>Here is my code so far (obviously wrong):</p>
  
  <pre><code>INSERT INTO Table3 (Id_Table3, Id_Table1, Id_Table2) 
  
  SELECT Id_Table2 FROM Table2 WHERE serial_no=" &amp; MyDGV.CurrentRow.Cells(0).Value.ToString
  
  VALUES (Id_Table3_seq.nextval, Id_Table1_seq.currval,????)
  </code></pre>
  
  <p>So, my problem stucks with Id_Table2 which needs to be selected first by Datagridview.Row cell value, and then result passed like a parameter to Table3. Any suggestions ? Probably an easy one, I just don't know how to start...</p>