Skip to content
Advertisement

How do I delete specific entries wherein there are duplicate entries

Sorry I’m just using this account from my old friend, he said he wanted it to have higher reputation. lol

I have a table that looks like this and I want to delete the entries wherein the next duplicate ones based from the first_name, middle_name, and last_name, and alias columns. While keeping the first entry or the ones who have the lowest possible id enter image description here

Advertisement

Answer

You can do it with a self join in the delete statement:

or by deleting all the rows with ids other than the min ids of each combination of first_name, last_name and alias:

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