title: Find rows matching a value and not matching another
body: <p>I did a search on the board before I posted this but I could not find anything that covers the same scenario, although I believe it is here buried somewhere I could not see it...</p>
  <p>I'm learning SQL and trying to build a query that returns the column <strong>IndexNr</strong>
  when <strong>IndexNr</strong> row contains the <strong>ID = x</strong> but <strong>IndexNr</strong> does not contain any row with <strong>ID = y</strong></p>
  <p>I not looking for any particular <strong>IndexNr</strong>... I want all of them that has <strong>ID = x</strong> but the same <strong>IndexNr</strong> that returns a match for <strong>ID = x</strong> cannot be considered a match if it also has <strong>ID = y</strong> in one of the rows from <strong>Pos</strong> column... Does that makes sense?</p>
  <pre><code>IndexNr     Pos    ID
  ----------- ------ -----------
  100001      0      -30140
  100001      1      -28877
  100001      2      -31659
  100001      3      -28282
  100003      0      -30262
  100003      1      -30261
  100003      2      -30260
  </code></pre>
  <p>So I tried this, but of course my limited SQL skills are keeping me from seeing the further clauses I'm missing to achieve this outcome...</p>
  <pre><code>SELECT [ToolNr] FROM [WTData].[dbo].[ToolParts] 
  WHERE PartID = -30140 AND PartID &lt;&gt; -28877
  ORDER BY [ToolNr]
  </code></pre>
  <p>From the query above, the <strong>IndexNr 100001</strong> should not be returned as a match...</p>
  <p>Thanks in advance!</p>