title: How to select posts with specific tags/categories in WordPress
body: <p>This is a very specific question regarding <strong>MySQL</strong> as implemented in <strong>WordPress</strong>.</p>
  <p>I'm trying to develop a plugin that will show (select) posts that have specific '<strong>tags</strong>' and belong to specific '<strong>categories</strong>' (both multiple)</p>
  <p>I was told it's impossible because of the way categories and tags are stored:</p>
  <ol>
  <li><code>wp_posts</code> contains a list of posts, each post have an &quot;ID&quot;</li>
  <li><code>wp_terms</code> contains a list of terms (both categories and tags). Each term has a TERM_ID</li>
  <li><code>wp_term_taxonomy</code> has a list of terms with their TERM_IDs and has a Taxonomy definition for each one of those (either a Category or a Tag)</li>
  <li><code>wp_term_relationships</code> has associations between terms and posts</li>
  </ol>
  <p>How can I join the tables to get all posts with tags &quot;Nuclear&quot; <strong>and</strong> &quot;Deals&quot; that also belong to the category &quot;Category1&quot;?</p>