Skip to content
Advertisement

Remove duplicate based on 2 rows value

So I have a database with more than 2000 line and I wanted to delete the duplicate value based on 2 rows.

For Example :

So basically I wanted to remove the duplicate IF two of the rows have a duplicate
BUT I dont want to remove them if just one of the row has duplicate.

Expected Output:

Any answer would be appreciated.

Advertisement

Answer

There is many ways to do what you want. If you ‘re looking for just SELECTing the data without duplicates then you could use:

  • DISTINCT

  • GROUP BY

  • Window function (ROW_NUMBER) in a subquery

You delete the duplicates as

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement