title: How to do update with join
body: <p>just think I have a table1 like shown below</p>
  
  <pre><code>table1
  
  id  product
  2   chocolate
  1   chocolate
  2   pepsi
  3   fanta
  2   pepsi
  4   chocolate
  5   chips
  3   pizza
  1   coke
  2   chips
  6   burger
  7   sprite
  0   pepsi
  </code></pre>
  
  <p>and want to arrange the above table in the manner shown below using only mysql</p>
  
  <pre><code>table2
  
  id  product
  0   pepsi
  1   chocolate, coke
  2   chocolate,fanta,chips
  3   fanta,pizza
  4   chocolate
  5   chips
  6   burger
  7   sprite
  </code></pre>
  
  <p>the above thing can be done by using</p>
  
  <pre><code>select id, group_concat(distinct product) as products 
  from table1 
  group by id 
  order by id
  </code></pre>
  
  <p>and after that i want the product column from table2 to be updated in another table which is named table3, which is shown below, here i want to update the products column from table2 as things column in table3 and the number in table3 = id from table2</p>
  
  <pre><code>table3
  
  number  name      things
  0       hi        null
  1       hello     null
  2       hehe      null
  3       wow       null
  4       hi        null
  5       hi        null
  6       hi        null
  7       hi        null
  </code></pre>
  
  <p>and i want the final output to be shown as in table2</p>
  
  <pre><code>table3
  
  number  name    things
  0       hi      pepsi
  1       hello   chocolate, coke
  2       hehe    chocolate,fanta,chips
  3       wow     fanta,pizza
  4       hi      chocolate
  5       hi      chips
  6       hi      burger
  7       hi      sprite
  </code></pre>