I have around 2000 exact duplicates in table and I want to delete one of them is there a way:
The sample data looks like:
Year ID Name Type
2015 200 John S
2015 200 John S
2014 100 Peter T
2014 100 Peter T
and I want output as :
Year ID Name Type
2015 200 John S
2014 100 Peter T
I have tried using Row_number but not sure how to delete
I’m going to assume you want to KEEP one row, not DELETE one row. It also wasn’t clear if you only wanted to target this specific set of values or handle all sets of duplicates.
If you want to delete one row and keep 1999 duplicates, then change the last line to:
If you want to only handle this set, remove the
/*and*/.I also recommend staying away from bad column names like
yearandtype(they require square brackets in a lot of cases) andID(what does that mean?).