title: Combine Multiple child rows into one row MYSQL
body: <p>Thanks in advance, I just can't seem to get it!</p>
  
  <p>I have two tables</p>
  
  <p><strong>Ordered_Item</strong></p>
  
  <pre>ID | Item_Name
  1  | Pizza
  2  | Stromboli</pre>
  
  <p><strong>Ordered_Options</strong></p>
  
  <pre>Ordered_Item_ID | Option_Number | Value
          1               43         Pepperoni
          1               44         Extra Cheese
          2               44         Extra Cheese</pre>
  
  <p>What I am looking to output is a mysql query is something to this effect</p>
  
  <p><strong>Output</strong></p>
  
  <pre>ID | Item_Name | Option_1 | Option_2
  1    Pizza       Pepperoni  Extra Cheese
  2    Stromboli     NULL     Extra Cheese</pre>
  
  <p>I have tried numerous options most ending in syntax error, I have tried group_concat but thats not really what I am looking for.  I have a crude example below of what I think might be a start. I need the options to be in the same order every time. And in the program where the info is collected there is no way to reliable ensure that will happen. Is it possible to have them concatenate according to option number. Also I know that I will never have over 5 options so a static solution would work</p>
  
  <pre><code>Select Ordered_Items.ID,
      Ordered_Items.Item_Name,
  FROM Ordered_Items
      JOIN (SELECT Ordered_Options.Value FROM Ordered_Options Where Option_Number = 43) as Option_1 
          ON Ordered_Options.Ordered_Item_ID = Ordered_Item.ID
      JOIN (SELECT Ordered_Options.Value FROM Ordered_Options Where Option_Number = 44) as Option_2 
          ON Ordered_Options.Ordered_Item_ID = Ordered_Item.ID;
  </code></pre>
  
  <p>Thanks!
  Joe</p>