title: How to retrieve identical entries from two different queries which are based on the same table
body: <p>I think I got a knot in my line of thought, surely you can untie it.</p>
  <p>Basically I have two working queries which are based on the same table and result in an identical structure (same as source table). They are simply two different kinds of row filters. Now I would like to &quot;stack&quot; these filters, meaning that I want to retract all the entries which are in query a and query b.</p>
  <p>Why do I want that?
  Our club is structured in several local groups and I need to hand different kinds of lists (e.g. members with email-entry) to these groups. In this example I would have a query &quot;groupA&quot; and a query &quot;newsletter&quot;. Another could be &quot;groupB&quot; and &quot;activemember&quot;, but also &quot;groupB&quot; and &quot;newsletter&quot;. Unfortunately each query is based on a set of conditions, which imho would be stored best in a single query instead of copying the conditions several times to different queries (in case something changes).</p>
  <p>Judging from the Venn diagrams <a href="https://i.stack.imgur.com/RxFM7.png" rel="nofollow noreferrer">1</a>, I suppose I need to use <code>INNER JOIN</code> but could not get it to work. Neither with the LibreOffice Base query assistant nor an SQL-Code. I tried this:</p>
  <pre><code>SELECT groupA.*
  FROM groupA
  INNER JOIN newsletter
  ON groupA.memberID = newsletter.memberID
  </code></pre>
  <p>The error code says: <code>Cannot be in ORDER BY clause in statement</code>
  I suppose that the problem comes from the fact, that both queries are based on the same table.</p>
  <p>May be there is an even easier way of nesting queries?
  I am hoping for something like</p>
  <pre><code>SELECT * FROM groupA
  WHERE groupA.memberID = newsletter.memberID
  </code></pre>
  <p>Thank you and sorry if this already has a duplicate, I just could not find the right search terms.</p>