title: Excluding a Null value returns 0 rows in a sub query
body: <p>I'm trying to clean up some data in SQL server and add a foreign key  between the two tables.  </p>
  
  <p>I have a large quantity of orphaned rows in one of the tables that I would like to delete.  I don't know why the following query would return 0 rows in MS SQL server. </p>
  
  <p>--This Query returns no Rows</p>
  
  <blockquote>
    <p>select * from tbl_A where ID not in (  select distinct ID  from tbl_B 
    )</p>
  </blockquote>
  
  <p>When I include IS NOT NULL in the subquery I get the results that I expect. </p>
  
  <p>--  Rows are returned that contain all of the records in tbl_A but Not in tbl_B </p>
  
  <blockquote>
    <p>select * from tbl_A where ID not in (  select distinct ID  from tbl_B
    where ID is not  null  )</p>
  </blockquote>
  
  <p>The ID column is nullable and does contain null values.  IF I run just the subquery I get the exact same results except the first query returns one extra NULL row as expected.  </p>