title: SQL Query to find record where one of the composite primary keys should be Max against other composite primary key
body: <p>Following is my table:</p>
  
  <pre><code>PatientID|VisitID|Date|Accident|Diagnosis|Doctor
    1      |    1  |    |        |         | 
    1      |    2  |    |        |         |
    1      |    3  |    |        |         |
  </code></pre>
  
  <p>Both <code>PatientID</code> and <code>VisitID</code> are composite primary keys. Now I want to show only the last record. In other words where <code>PatientID</code>=<code>1</code> and <code>VisitID</code>=Maximum.</p>
  
  <p>So what would the query be?</p>