title: How to get mysql data into separated columns?
body: <p>I am trying to figure out how to get (Joomla/Virtuemart) column values into separated columns. </p>
  
  <p>Table: jos_vm_order_item.</p>
  
  <p>MySql 5.0. (can't change it)</p>
  
  <p>I have orders (order_id) and each order has items (order_item_id) from 1 to 3.</p>
  
  <pre>
  order_id    order_item_id
  1329        1427
  1329        1428
  1330        1429
  </pre>
  
  <p>I would like to get order_item_id's into separated columns suchs as (order_item_id_1, order_item_id_2, order_item_id_3) as follows</p>
  
  <p>[My objective]</p>
  
  <pre>
  order_id    order_item_id_1     order_item_id_2     order_item_id_3
  1329        1427                1428
  1330        1429
  </pre>
  
  <p>As shown, there is only 2 items in these two orders.</p>
  
  <p>This is what I managed to get working. </p>
  
  <pre><code>SELECT order_id, GROUP_CONCAT(CONVERT(order_item_id, CHAR(8)))
  FROM jos_vm_order_item
  GROUP BY order_id
  </code></pre>
  
  <pre>
  order_id    order_item_id
  1329        1427,1428
  1330        1429
  </pre>
  
  <p>However, I need order_item_id's into separated columns [as 'My objective' illustrates].</p>
  
  <p>I would really appreciate if someone could help me about this issue. </p>
  
  <p>I have googled a Lot and I couldn't find out if I could use join for this or not. I can't figure out how to create new columns from the above data.</p>
  
  <p>Best, Jan</p>