I am trying to remove duplicates from a table. Not all the students have duplicates though. I will provide 2 scenarios below: Any sugestions? I am using this query but it just removes the duplicate ids. I need more logic based on status and year.
The first scenario I would want the record that has STATUS = Final AND the most recent YEAR. (This is the 3rd record of id 1)
The second scenario since there IS NO Final I just will take the record with the most recent YEAR (This is the second record of id 2)
This example shows how to use
I then choose the row number 1's from that data set and I've eliminated the dupes.
where a.rn = 1
answered May 04, 2012 at 08:10 PM
Kev Riley ♦♦
You can also use this solution to delete the duplicates:
Read more at this question:
answered Oct 10, 2012 at 07:19 AM