Strange results from NOT IN subquery
<p>I have this simple query:</p>

<pre><code>SELECT COUNT(SalesOrderId)
FROM SalesOrder
</code></pre>

<p>It gives a result of 14000</p>

<p>Then I have</p>

<pre><code>SELECT COUNT(SalesOrderId)
FROM SalesOrder
WHERE SalesOrderId     IN (SELECT New_DSheetId FROM New_dealsheet)
</code></pre>

<p>That gives 4169</p>

<p>If I then do</p>

<pre><code>SELECT COUNT(SalesOrderId)
FROM SalesOrder
WHERE SalesOrderId NOT IN (SELECT New_DSheetId FROM New_dealsheet) 
</code></pre>

<p>I'm expecting 9831 but the result is 0</p>

<p>Not sure why that is?</p>