title: SQL Selecting rows with multiple values
body: <p>I have these 2 tables: </p>
  
  <p>Table <code>SW_ITEM</code>:</p>
  
  <pre><code>ID  SWID  ITEM_ID
  1    1      99
  2    2      99
  3    5      99
  4    2      100
  5    1      100
  6    1      101
  7    2      102
  </code></pre>
  
  <p>Table <code>ITEM</code>:</p>
  
  <pre><code>  ID   FILENAME
    99      abc
    100     def
    101     geh
    102     ijk
  </code></pre>
  
  <p>column <code>ITEM_ID</code> is a foreign key to the column <code>ID</code> of table <code>ITEM</code>.</p>
  
  <p>So I want all filenames which have the SWID "1" AND "2" (that would be ITEMID 99 and 100, so their filenames are "abc" and "def")</p>
  
  <p>Here I have to say that it is possible that <code>ITEM_ID</code> has more than one entry with the same SWID, so I cannot use this SQL:</p>
  
  <pre><code>SELECT ITEM_ID FROM SW_ITEM
  WHERE SWID  IN (1,2) 
  GROUP BY ITEM_ID
  HAVING COUNT(ITEM_ID) = 2
  </code></pre>
  
  <p>So is there any other possibility to get all entries which have the SWID 1 and 2 (creating a join for every SWID is also not an option - because with many entries it would be really slow)</p>
  
  <p>Kind regards</p>