title: MySQL select multiple fields using vertical data
body: <p>I have a MySQL database where the table was set up to store the data in a vertical fashion: </p>
  
  <pre><code>Userid -- Field -- Data
  186       30       New York
  186       31       Phone
  186       32       Delta
  
  187       30       Los Angeles
  187       31       Website
  187       32       US Air
  </code></pre>
  
  <p>I am able to select columns if they are already horizontal but want to be able to organize the output so it looks like this:</p>
  
  <pre><code>Userid -- Data30   --   Data31 -- Data32
  186       New York      Phone     Delta
  187       Los Angeles   Website   US Air
  </code></pre>
  
  <p>How do I say "Select DATA30 to show for this column but only if FIELD equals 30"?</p>