title: wordpress custom query to select a meta value
body: <pre><code>SELECT b.post_title, a.post_id, COUNT( * ) as Total
  FROM  wp_posts b INNER JOIN 
              wp_postmeta a ON a.post_id = b.ID
      WHERE a.meta_value = 1
        AND a.meta_key = 'type-select' 
        AND b.post_status = 'publish'
        and post_type = 'car-cc'
  GROUP BY b.post_title, a.post_id
  </code></pre>
  
  <p>Currently it select's <code>post title</code> and <code>post id</code> but i also need to select a <code>meta value</code> where <strong>meta key = type-gen</strong> the problem is another meta key is already compared in the query.</p>
  
  <p>SQL Fiddle: <a href="http://sqlfiddle.com/#!2/109c2/1" rel="nofollow">http://sqlfiddle.com/#!2/109c2/1</a></p>