SQL Server 2016: How to remove records that are NOT duplicates but have duplicate values?

Viewed 49

I'm new here and relatively new to SQL. I have a table similar to this:

[Pk], [Case_No], [Status], [Open_Date], [Close_Date], [Case_Age], [Report_Date]

Every week, all cases, open or closed, are dumped into the table with a new report date. What I want to do is be able to remove the records that are reoccurring that have already been closed. I want to keep the first instance where the case was reported as closed, but I don't need the duplicates (unless the case is still open.) I hope this makes since...it has been a long day. I already have a solution going forward, but I need to clean up historical records to report correctly.

If i could figure out how to add a flag or something...I have tried Dense_Rank(), but I don't want the null close dates ranked...

I have googled for ideas for days and I am now turning to the experts for suggestions. Any help is greatly appreciated! Thanks in advance!

1 Answers
Related