If any of the values in the Table2 has null
then First query gets transalted to
SELECT * FROM Table1
WHERE (ID <> NULL and ID <> SomeValue and...)
ID<>NULL
is unkown .Hence you don't get any result
where as, in your 2nd query you are eliminating the NULL
.Hence you don't get an unknown value .
You can also write your query using Not Exists
SELECT * FROM Table1
WHERE
NOT Exists (SELECT 1 FROM Table2 where Table1ID = ID )