title: Find all children who are not parent
body: <p>I'm trying to retrieve all children who are not parent.</p>
  
  <p>The table looks like this</p>
  
  <pre><code>ID  |  ParentID
  ---------------
  1        NULL
  2         1
  3        NULL
  4         2
  </code></pre>
  
  <p>At first I tried</p>
  
  <pre><code>SELECT *
  FROM [SMD].[dbo].[ProposalFollowUp]
  WHERE ID NOT IN (SELECT ParentID FROM [SMD].[dbo].[ProposalFollowUp])
  </code></pre>
  
  <p>but it returns no row.
  I wanted to select all rows that are not in parentID. I don't understand why it's not working.</p>
  
  <p>Then I tried this</p>
  
  <pre><code>SELECT *
  FROM [SMD].[dbo].[ProposalFollowUp] AS a
  WHERE a.ID NOT IN 
  (SELECT b.ID FROM [SMD].[dbo].[ProposalFollowUp] as b WHERE b.ParentID = a.ID)
  </code></pre>
  
  <p>but this returns all rows</p>
  
  <p>Anyone can tell me what I'm missing</p>
  
  <p>Thank you!</p>