title: How do I query Wordpress's MySQL for a list of users who have a certain meta_value and a day-old registration date?
body: <p>I'm trying to search Wordpress's database for a list of users who 1) Have a certain capability, and 2) Registered more than 24 hours ago.</p>
  
  <p>For part 1, I wrote this query to single out a certain type of user. </p>
  
  <pre><code>$querystr ="SELECT user_id, meta_value FROM wp_usermeta WHERE meta_value LIKE '%s2member_level5%'";
  </code></pre>
  
  <p>Then, for part 2, I started writing this query to check for Wordpress user accounts that were day-old or older. (I don't think I'm doing it right.)</p>
  
  <pre><code>$agingstr ="SELECT ID, user_registered FROM wp_users WHERE datediff(now(),`user_registered`)&gt;=1";
  </code></pre>
  
  <p>My goal is to combine the two, using the user_id key, and providing us with a list that satisfies both criteria. </p>
  
  <p>The desired list would take the form of user ID keys that meet both criteria in both tables.</p>
  
  <p>Any help much appreciated.</p>
  
  <p>(I know it's an unfortunate EAV pattern but we're stuck with it because of the nature of  Wordpress.)</p>