title: SQL Select Max Date with Multiple records
body: <p>I am struggling with a query to pull most recent entries.  I have a Notes table that contains the following columns:</p>
  
  <pre><code>BusinessDate
  ReportGuid
  NoteGuid
  Note
  NoteDate
  NoteAddedBy
  </code></pre>
  
  <p>The BusinessDate, ReportGuid and NoteGuid are the PK on the table.  This table allows a specific ReportGuid to have multiple notes per day.  I have another table that contains additional Report info that will be joined and displayed for the users.  I am trying to pull and display only the most recent note entry for each ReportGuid.</p>
  
  <p>I tried using Max(NoteDate) but that is only getting me the latest note added to the table not the latest note for each ReportGuid. </p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p>UPDATE:</p>
  
  <p>thanks for the help:</p>
  
  <pre><code>SELECT N.Note, N.ReportGuid
  FROM Tracking.SM_T_Report_Notes N
  RIGHT OUTER JOIN
      (
      SELECT ReportGuid, Max(NoteDate) As NoteDate
      FROM Tracking.SM_T_Report_Notes
      GROUP BY ReportGuid
      ) AS ND
      ON  N.NoteDate = ND.NoteDate
  </code></pre>