title: How to get a single variable in Wordpress
body: <p>I am running a competition which is based on WP Custom Fields. I am trying to count all meta values of a meta_key='odd' for a specific user. I am using the formula below but it's not returning any result. </p>
  
  <pre><code>$meta_key = 'odd';
  $post_author = 'Admin';
  $odd = $wpdb-&gt;get_var( $wpdb-&gt;prepare(
      "
      SELECT Count(meta_value)
      FROM $wpdb-&gt;postmeta
      INNER JOIN $wpdb-&gt;posts ON $wpdb-&gt;postmeta-&gt;post_id = $wpdb-&gt;posts-&gt;ID
      WHERE $wpdb-&gt;postmeta-&gt;meta_key = 'odd' AND $wpdb-&gt;posts-&gt;post_author = 'Admin'
      ",
      $meta_key, $post_author
  ) );
  echo "&lt;p&gt;Total odd {$odd}&lt;/p&gt;";
  </code></pre>
  
  <p>Anyone can help me? Thanks in advance. </p>