title: Fetch data with single and fast SQL query
body: <p>I have the following data:</p>
  
  <pre><code>ExamEntry   Student_ID     Grade
    11           1             80
    12           2             70
    13           3             20
    14           3             68
    15           4             75
  </code></pre>
  
  <p>I want to find all the students that passed an exam. In this case, if there are few exams
  that one student attended to, I need to find the last result.</p>
  
  <p>So, in this case I'd get that all students passed.</p>
  
  <p>Can I find it with one fast query? I do it this way:</p>
  
  <ol>
  <li><p>Find the list of entries by
  select max(ExamEntry) from data group by Student_ID</p></li>
  <li><p>Find the results:</p></li>
  </ol>
  
  <p>select ExamEntry from data where ExamEntry in ( ).</p>
  
  <p>But this is VERY slow - I get around 1000 entries, and this 2 step process takes 10 seconds.</p>
  
  <p>Is there a better way?</p>
  
  <p>Thanks.</p>