title: Transpose a row into columns with MySQL without using UNIONS?
body: <p>I have a table that is similar to the following below:</p>
  
  <pre><code>       id |        cat |         one_above |        top_level | 
          0    'printers'          'hardware'        'computers'
  </code></pre>
  
  <p>I want to be able to write a query, <strong>without using unions</strong>, that will return me a result set that transposes this table's columns into rows. What this means, is that I want the result to be:</p>
  
  <pre><code>       id |          cat |
          0      'printers'
          0      'hardware'
          0     'computers'
  </code></pre>
  
  <p>Is this possible in MySQL? I can not drop down to the application layer and perform this because I'm feeding these into a search engine that will index based on the id. Various other DBMS have something like PIVOT and UNPIVOT. I would appreciate any insight to something that I'm missing.</p>
  
  <p>Mahmoud</p>
  
  <p>P.S.</p>
  
  <p>I'm considering re-normalization of the database as a last option, since this won't be a trivial task.</p>
  
  <p>Thanks!</p>