title: Select where MAX(DATE) between X and X
body: <p>I'm trying to select only patients, who had their LAST appointment in the year 2015. The ideal thing would look like this:</p>
  
  <pre><code>Select person.name, person.surname
  inner join patient on patient.pat_id=person.per_id
  inner join appointment on appointment.pat_id=patient.pat_id
  where MAX(appointment.date) between '31.12.2014'and '01.01.2016'
  </code></pre>
  
  <p>But of MAX isn't allowed in WHERE clause. What's the best workaround?</p>