title: SQL Max by date and term
body: <p>I have some data that look like this:</p>
  <pre><code>table
  </code></pre>
  <p><a href="https://i.stack.imgur.com/qe6G7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qe6G7.png" alt="enter image description here" /></a></p>
  <p>I would like to get, by term, the most recent upload date</p>
  <p>I've tried this but I know I have placed the term parameters in the wrong place because I only got the max date of the whole group instead of max date within both the <code>1</code> term and the <code>4</code> term.</p>
  <pre><code>SELECT Inst, Term, Year, FreezeDate, UploadDate, RecordCount, ErrorCount, FileName, System, 
  FROM table
  WHERE UploadDate=(
  SELECT MAX(UploadDate) FROM table WHERE System = ('a') and Year = ('2017') and Inst = ('123') and (Term = ('1') or Term = ('4')))
  </code></pre>
  <p>My ideal output would be this:
  <a href="https://i.stack.imgur.com/T5xfW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T5xfW.png" alt="enter image description here" /></a></p>
  <p>Could someone assist?</p>