title: SQL Where Not Exists
body: <p>I think I have a misunderstanding of how NOT EXISTS work and hope it can be clarified to me.</p>
  
  <p>Here is the sample code I am running (also on <a href="http://sqlfiddle.com/#!4/9eecb/2495" rel="nofollow">SQL Fiddle</a>)</p>
  
  <pre><code>select sum(col1) col1, sum(col2) col1, sum(col3) col3
  from (
    select 1 col1, 1 col2, 1 col3
    from dual tbl1
    )
  where not exists(
    select 2 col1, 1 col2, 1 col3
    from dual tbl2
  )
  </code></pre>
  
  <p>I thought that it should return:</p>
  
  <pre><code>1, 1, 1
  </code></pre>
  
  <p>But instead it returns nothing.</p>
  
  <p>I make this assumption only on the fact that I though NOT EXISTS would give me a list of all the rows in the first query that do not exist in the second query (in this case 1,1,1)</p>
  
  <ol>
  <li>Why does this not work</li>
  <li>What would be the appropriate way to make it work the way I am expecting it to?</li>
  </ol>