title: Insert data into table with result from another select query
body: <p>I am seeking help on the following issue:
  I have two tables
  <code>Table_1</code> columns are <code>itemid</code>, <code>locationid</code>, <code>quantity</code></p>
  
  <p><code>Table_2</code> columns are <code>itemid</code>, <code>location1</code>, <code>location2</code>, <code>location3</code></p>
  
  <p>I want to copy data from <code>Table_1</code> (only <code>quantity</code> column) into <code>Table_2</code> (into <code>location1</code> column). The <code>itemid</code> are same in both the tables(<code>Table_1</code> has duplicate item id's) so that's the reason I want to copy to a new table and keep all quantity in one single row with each location as a column. I am using the below query but it doesn't work</p>
  
  <pre><code>INSERT INTO 
  Table_2(location1) 
  (
   SELECT qty 
   FROM Table_1 
   WHERE locationid = 1 AND Table_1.locationid = Table_2.locationid
  )
  </code></pre>