title: Wordpress Usermeta Select multiple keys and values
body: <p>trying to retrieve all user_id's where those user_id's meet a 3 criteria.</p>
  
  <p>the code I have is </p>
  
  <pre><code>$sql = "
  SELECT user_id
  FROM {$wpdb-&gt;usermeta} 
  WHERE (({$wpdb-&gt;usermeta}.meta_key = 'job_title' AND {$wpdb-
  &gt;usermeta}.meta_value = '".$job_title."') OR
  ({$wpdb-&gt;usermeta}.meta_key = 'pmpro_bstate' AND {$wpdb-
  &gt;usermeta}.meta_value = '".$state."') OR
  ({$wpdb-&gt;usermeta}.meta_key = 'pmpro_baddress2' AND {$wpdb-
  &gt;usermeta}.meta_value = '".$suburb."'))
  GROUP BY
     user_id
  HAVING 
     COUNT(DISTINCT meta_key)=3";
  </code></pre>
  
  <p>Is Lower() needed on the value and variables to compare them accurately ?</p>
  
  <p>And is there a more efficient way to perform this query ?</p>
  
  <p>Cheers</p>