title: SQL WHERE NOT EXISTS query not returning results
body: <p>I'm having trouble constrsucting a query and getting it to run on impala. I created the following working query to join two tables: </p>
  
  <pre><code>SELECT *
  FROM illuminavariant as vcf, ensembl_genes as ens 
  WHERE vcf.filter = "PASS" 
  AND vcf.qual &gt; 100 
  AND vcf.chromosome = ens.chromosome
  AND vcf.position BETWEEN ens.start AND ens.stop
  </code></pre>
  
  <p>Now I'm trying to write a query that finds all variants WHERE vcf.filter = "PASS" and vcf.qual > 100, but do not have a match by chromosome and position. </p>
  
  <p>I've tried this: </p>
  
  <pre><code>SELECT * 
  FROM p7dev.illumina_test, p7dev.ensembl_test
  WHERE NOT EXISTS(
    SELECT * 
    FROM p7dev.illumina_test as vcf, p7dev.ensembl_test as ens
    WHERE vcf.chromosome = ens.chromosome  
    AND vcf.position BETWEEN ens.start AND ens.stop  
   )
  </code></pre>
  
  <p>But that's not returning any results. I think a WITH clause might do the trick, but I'd really appreciate if anybody could help me wrap my head around the logic of how that would work. Thanks so much! </p>