title: Transposing data in MySql
body: <p>How can I transpose information from a column into a row?</p>
  
  <p>I have the following table:</p>
  
  <pre><code>Drop table if exists Example;
  Create table Example
      (
      ID int,
      Group_ID int,
      Group_Name varchar(16)
      );
  Insert into Example (ID, Group_ID, Group_Name)
      Values
      ('1','11', 'A'),
      ('1','21', 'K'),
      ('2','16', 'E'),
      ('2','6', 'Z')
      ;
  Select * from Example;
  </code></pre>
  
  <p>And I want to split the information given in the field Group_ID and Group_Name for each ID. It should finally look like this:</p>
  
  <pre><code>Drop table if exists Solution;
  Create table Solution
      (
      ID int,
      Group_ID_First_Entry int,
      Group_ID_Second_Entry int,
      Group_Name_First_Entry varchar(16),
      Group_Name_Second_Entry varchar(16)
      );
  
  Insert into Solution (ID, Group_ID_First_Entry, Group_ID_Second_Entry, Group_Name_First_Entry, Group_Name_Second_Entry)
      Values
      ('1','11', '21', 'A', 'K'),
      ('2','16', '6', 'E', 'Z')
      ;
  Select * from Solution;
  </code></pre>
  
  <p>I tried to use something like 'Case when' but it didn't work.</p>
  
  <p>Thanks for your help!</p>