title: Convert multy rows to columns
body: <p>I'm trying to retrive data from MySQL data base.
  The structure of the table (<code>Tab_1</code>) there is:</p>
  
  <pre><code>id   key      value
   1   address   xyz
   1   post_code 120
   1   country   CA
  </code></pre>
  
  <p>As you can see this is actually order details information.</p>
  
  <p>I want to convert the key column to be an actual column and the value to be the value of this column.
  meaning:</p>
  
  <pre><code>    id  address  post_code  country
   ------------------------------------
      1    xyz       120         CA
  </code></pre>
  
  <p>Where <code>id=1</code> is the key of this order.</p>
  
  <p>The table in MySQL can not be changed. Its part of a close system that we use (WordPress plugin) I just want to write a query that gets some data from it...</p>
  
  <p>My goal is to use it in a join where it would be easier to get the data:</p>
  
  <pre><code>Select x.address ,x.post_code, x.country
  from orders
  join (...) as x using (order_id=id)
  where order_id=1
  </code></pre>
  
  <p>It should give:</p>
  
  <pre><code>    address  post_code  country
   ------------------------------------
        xyz        120         CA
  </code></pre>
  
  <p>As you can see it suppose to get all fields of x which is the address,post_code,country etc.
  the <code>...</code> in the join is where I need to put the query that convert <code>Tab_1</code> to a readable stracture for the join.</p>
  
  <p>How can I do that?</p>