title: SQL: INNER JOIN + NOT EXIST
body: <p>I am trying to create an SQL statement where I need to join 3 tables</p>
  
  <p><strong>EnrollStudents</strong></p>
  
  <pre><code>EnrollID     UserID     SubjID
  1            1          1
  2            1          2
  3            1          3
  4            3          1
  5            7          2
  </code></pre>
  
  <p><strong>Students</strong></p>
  
  <pre><code>StudentID     UserID     YearID
  1             1          1
  2             3          1
  3             7          1
  </code></pre>
  
  <p><strong>Subjects</strong></p>
  
  <pre><code>SubjID     SubjCode     YearID
  1          English      1
  2          Math         1
  3          Science      1
  </code></pre>
  
  <p>and the output should be...</p>
  
  <pre><code>UserID
  2
  3
  </code></pre>
  
  <p>since <code>User 1</code> already enrolled all the subjects, while <code>User 3</code> and <code>User 7</code> are still shown since some subjects are still not enrolled.</p>
  
  <p>I have the following SQL statement with no luck:</p>
  
  <pre><code>SELECT Students.UserID 
  FROM Students 
  WHERE Students.YearID = 1 
      AND Students.UserID NOT IN (SELECT EnrollStudents.UserID 
                                  FROM EnrollStudents)
  </code></pre>
  
  <p>Any ideas?</p>