title: mySQL query to target different keys
body: <p>I have a query that returns the user's top published posts in post_status <code>publish</code>. </p>
  
  <p>Looks like this:</p>
  
  <pre><code>$results=$wpdb-&gt;get_results( $wpdb-&gt;prepare(
      "
     SELECT      tt.term_id as category, COUNT(p.ID) as count
     FROM        $wpdb-&gt;posts p
  
     JOIN        $wpdb-&gt;term_relationships tr
                 ON p.ID = tr.object_id
  
     JOIN        $wpdb-&gt;term_taxonomy tt
                 ON tt.term_taxonomy_id = tr.term_taxonomy_id
                 AND (tt.taxonomy = %s AND tt.term_taxonomy_id != 1)
  
     WHERE       p.post_author = %s and p.post_status = 'publish'
     GROUP BY    tt.term_id
     ORDER BY    count DESC LIMIT 3
  ",
      $taxonomy,
      $user_id
  ) );
  </code></pre>
  
  <p>It checks for the <code>post_author</code> ID and checks if <code>post_status</code> is <code>publish</code>. Works fine. However, I want to find posts from <code>post_status</code> <code>publish</code> and <code>active</code>. </p>
  
  <p>I tried setting <code>WHERE</code> to:</p>
  
  <pre><code>p.post_author = %s and p.post_status = 'publish' or p.post_status = 'active'
  </code></pre>
  
  <p>But this returned all <code>active</code> posts, not <strong>specifically</strong> this user's.</p>
  
  <p>How can I change my query so it targets both <code>publish</code> and <code>active</code> for this user?</p>