title: SQL - Insert into a table for a specific list of IDs
body: <p>I have a Select statement that returns a list of primary key (user_id).</p>
  
  <pre><code>select user_id from myttable
  where &lt;some-condition&gt;;
  </code></pre>
  
  <p>Then I would like to insert a new row for each of those returned IDs from the previous Select. Can I do this in a single SQL Query? Can it be something like this? It looks a lot like I would need a loop in here somehow.</p>
  
  <pre><code>insert into mytable 
  values (user_id, value1, value2, value3, value4, value5)
  where user_id in 
  (select user_id from myttable
      where &lt;some-condition&gt;)
  </code></pre>
  
  <p><code>value1, value2, ..., value5</code> are the same for all the insert(s), except for <code>user_id</code>.
  I could have done "update" instead of insert, but I need to keep the old rows for some other purpose.</p>
  
  <p>So far what I did is was I just got a list of user_id(s), and in Java, went through that list and do insert one by one.</p>