title: Turning a Wordpress post_meta table into an easier to use View
body: <p>I'm using Wordpress and trying to create a view to make reviewing and analyzing my resort data a little easier. Resort data is stored in the post_meta table in Wordpress and referenced in a custom post type known as "resorts". The following query gives me the result set I want to parse:</p>
  
  <pre><code>SELECT a.id, a.post_type, a.post_title, b.post_id, b.meta_key, b.meta_value
  FROM alpinezone_postmeta b
  INNER JOIN alpinezone_posts a ON a.id = b.post_id
  WHERE a.post_type = "resorts" 
  </code></pre>
  
  <p>What I want to do with this result set is have each unique meta_key of a set I define become a column and then each row should be a unique b.post_id (or a.id), which corresponds to an individual resort's record. </p>
  
  <p>So ultimately I end up with: </p>
  
  <pre><code>post_title |   phone_num      | state         |
  resort1    |   800-200-1111   | Vermont       |
  resort2    |   800-200-2222   | New Hampshire |
  resort 3   |   800-200-2323   | Maine         |
  </code></pre>
  
  <p>Basically ...... I'm not that great at MySQL so trying to figure out the best way to handle this. I do have a list of all the meta_key I want to place into columns, there are 36 of them capturing a range of information. </p>
  
  <p><strong>EDIT: Some more detail.</strong> </p>
  
  <p><em>Current Structure</em> - shows what table it comes from as well</p>
  
  <pre><code>*alpinezone_posts   alpinezone_postmeta alpinezone_postmeta*
  post_title          meta_key            meta_value
  ----------------------------------------------------------------
  sugarloaf           snow_phone          888-234-2222
  sugarloaf           vertical_feet       2300
  sugarloaf           site_url            sugarloaf.com
  wachusett           snow_phone          888-111-2222
  wachusett           vertical_feet       1000
  wachusett           site_url            wachusett.com
  </code></pre>
  
  <p>These two tables are joined on post_id from table alpinezone_postmeta and id from table alpinezone_posts. </p>
  
  <p>Only want results where the post_type in table alpinezone_posts is = "resorts"</p>
  
  <p><em>How I want it to look in new view</em></p>
  
  <pre><code>post_title  snow_phone      vertical_feet   site_url
  -------------------------------------------------------
  sugarloaf   888-234-2222    2300            sugarloaf.com
  wachusett   888-111-2222    1000            wachusett.com
  </code></pre>