title: MySQL - put rows as columns and columns as rows?
body: <p>How can I transpose a row to a column in MySQL? </p>
  
  <p>I've read some questions on this topic on StackOverflow, but I still have no idea how I can achieve the result that I want. I've also tried some code without success.</p>
  
  <p>The following sample will hopefully make my desired result clear. I created a view named "summary_kcal" grouped by user-ID. It is composed as below:</p>
  
  <pre><code>+---------+------+------+------+------+------+------+------+
  | userid  |  LU  |  MA  |  ME  |  GIO |  VE  |  SA  | DO   | 
  +---------+------+------+------+------+------+------+------+
  | 1       | 1000 | 2000 | 1000 | 1500 | 2000 | 1000 | 1500 |
  +---------+------+------+------+------+------+------+------+
  </code></pre>
  
  <p>I want to convert it to:</p>
  
  <pre><code>+---------+---------+
  | userid  | 1       |
  +---------+---------+
  | LU      | 1000    | 
  +---------+---------+
  | MA      | 2000    | 
  +---------+---------+
  | ME      | 1000    |
  +---------+---------+
  | GIO     | 1500    |
  +---------+---------+
  | VE      | 2000    |
  +---------+---------+
  | SA      | 1000    |
  +---------+---------+
  | DO      | 1500    |
  +---------+---------+
  </code></pre>