title: Sqlite - Return rows where some values are different
body: <p>I have a large table a SQLite database of student exam results.  Students often resit failed exams and subsequently pass them as shown with student <strong>10001</strong> below.</p>
  <pre><code>+─────────────+────────+──────────────+──────────+────────+─────────────+
  | student_id  | level  | name         | outcome  | grade  | date        |
  +─────────────+────────+──────────────+──────────+────────+─────────────+
  | 10001       | Higher | Mathematics  | Pass     | A      | 01/04/2022  |
  | 10001       | Higher | Mathematics  | Fail     | F      | 01/02/2022  |
  | 10002       | Higher | English      | Pass     | B      | 01/04/2022  |
  +─────────────+────────+──────────────+──────────+────────+─────────────+
  </code></pre>
  <p>I would like to be able to do two things with this data.</p>
  <ol>
  <li><p>Return only the failed exam should it have a also have a pass entry recorded. In other word the row 2nd from the top in the image table.</p>
  </li>
  <li><p>Return the whole table but this time <strong>without</strong> the initial failed exam.  In other words everything minus the results from 1.</p>
  </li>
  </ol>
  <p>The exam is considered a resit if the <em>student_id</em>, <em>level</em> and <em>name</em> all match.  The other values in the rows can be different.</p>