title: MySql: Creating rows in a new table for each existing row in a different table
body: <p>Hey: I'm trying to do a MySql migration, but Im very new to the language, and the syntax is fustrating me. The basic idea of what I want to do is:</p>
  
  <p>-Get all of the events in table 1</p>
  
  <p>-For each of these events, insert a row into the ticketing_information table (these have an automatically generated id)</p>
  
  <p>-Set the event's ticketing_information_id to match the id in the newly generated row</p>
  
  <p>(then the same again for tables 2 and 3)</p>
  
  <p>So I have ideas about how the various steps might work, but I'm not sure how you combine various expressions in sql (is there a foreach? how do i pick the specific row that I just made, if I know nothing unique about it to identify it?)</p>