title: Delete Duplicate Rows in SQL
body: <p>I have a table with unique id but duplicate row information.</p>
  
  <p>I can find the rows with duplicates using this query</p>
  
  <pre><code>SELECT
      PersonAliasId, StartDateTime, GroupId, COUNT(*) as Count
  FROM
      Attendance
  GROUP BY
      PersonAliasId, StartDateTime, GroupId
  HAVING
      COUNT(*) &gt; 1
  </code></pre>
  
  <p>I can manually delete the rows while keeping the 1 I need with this query</p>
  
  <pre><code>Delete
  From Attendance
  Where Id IN(SELECT
      Id
  FROM
      Attendance
  Where PersonAliasId = 15
      and StartDateTime = '9/24/2017'
  and GroupId = 1429
  Order By ModifiedDateTIme Desc
  Offset 1 Rows)
  </code></pre>
  
  <p>I am not versed in SQL enough to figure out how to use the rows in the first query to delete the duplicates leaving behind the most recent.  There are over 3481 records returned by the first query to do this one by one manually.</p>
  
  <p>How can I find the duplicate rows like the first query and delete all but the most recent like the second?</p>