title: SQL 'NOT IN' Operator doesn't give expected results when comparing columns in two tables
body: <p>I need to update a table from a temporary table. Therefore I need to compare and find out what lines are not in the main table to be imported from the temp table.
  My tables look like follows,</p>
  
  <pre><code>line_id -&gt; nvarchar(20)
  order_no -&gt; nvarchar(20)
  line_no -&gt;int
  </code></pre>
  
  <p>Both tables have same fields but the temp table has more up to date records to be brought to the main table. I am using;</p>
  
  <pre><code>INSERT INTO main_table
    SELECT * FROM temp_table t 
    WHERE t.line_id NOT IN (SELECT line_id FROM main_table)
  </code></pre>
  
  <p>But the condition  <code>WHERE t.line_id NOT IN (SELECT line_id FROM main_table)</code> doesn't bring any order lines.
  But when <code>order_no</code> is used instead of <code>line_id</code>, the comparison is done and a number or order lines start to show up. But <code>order_no</code> is not an unique key and that comparison doesn't return all the lines needed.</p>
  
  <p>It would be great if you could help me.. Thanking in advance!</p>