title: Select by multiple tags (whitelist and blacklist)
body: <p>I have the following structure:</p>
  
  <pre><code>CREATE TABLE stories
  (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    dir TEXT,
    alias TEXT,
    title TEXT
  );
  
  CREATE TABLE tags
  (
    story_id INTEGER,
    name TEXT
  );
  </code></pre>
  
  <p>Now I want to select all stories that have (at least) given N tags, and do not have another N tags.</p>
  
  <p>Example: All stories with "fantasy" and "nature", but without "dragons"</p>
  
  <p>Here's a query I tried (for now just the "whitelist" part, but it's extremely slow - so I'm sure I'm doing it wrong.</p>
  
  <pre><code>SELECT s.*
  FROM stories s
  WHERE 
     (SELECT COUNT(*)
         FROM tags t
         WHERE 
             t.story_id = s.id
             AND t.name IN ('fantasy', 'nature')
     ) = 2
  </code></pre>
  
  <p>If I add "LIMIT 10" at the end, it works (but very slowly).</p>
  
  <p>No idea how to include the blacklist criteria into the query, though.</p>
  
  <p>Ideas?</p>
  
  <p>I have about 20.000 stories and 75.000 tag entries.</p>