title: Best way to make double insert
body: <p>What's the best way of inserting information in table A and using the index from table A to relate to table B.  </p>
  
  <p>The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last index may change between the inserts because another user could generate a new index in table A</p>
  
  <p>I have had this problem with various DBMS postgreSQL, Informix, MySQL and MSSQL (thanks to lomaxx for the answer)</p>