title: Specific MySQL Query: Combining Two MYSQL Select Statements with OR
body: <p>I need to check if an entry is categorized (query A) OR if an entry has a relationship with certain data (query B). I'd like to do this with one query rather than two separate queries. For example:</p>
  
  <pre><code>[if query A OR query B ]
     &lt;p&gt;Show this content&lt;/p&gt;
  [/if]
  </code></pre>
  
  <p>I have the two select queries working correctly, but only independently of one another. They are:</p>
  
  <p><strong>Query A:</strong></p>
  
  <pre><code>SELECT entry_id FROM exp_category_posts WHERE entry_id = '999' AND cat_id IN(SELECT cat_id FROM exp_categories WHERE group_id = '5') LIMIT 1
  </code></pre>
  
  <p><strong>Query B:</strong></p>
  
  <pre><code>SELECT entry_id FROM exp_matrix_data WHERE field_id = '19' AND col_id_7 &lt;&gt; '' AND entry_id = '999'
  </code></pre>
  
  <p>Again, I'd like to combine these two queries into a single query that checks if entry 999 is EITHER categorized in certain categories (query A) OR has a relationship with certain data (query B). What is the best way to do this?</p>
  
  <p>If it helps, the queries are being run on an ExpressionEngine database.</p>
  
  <p>Disclaimer: I know there are plenty of questions on SO on how to combine MySQL <code>SELECT</code> statements, but I am looking for help on this specific query, and didn't find any questions similar enough to my own. My apologies in advance if I have inadvertently angered the duplicate question gods.</p>