Skip to content
Advertisement

I want a single query that deletes duplicate entry from my database

I have written a query delete from Table1 where Tableid in(select Tableid from Table1 group by Tableid having count(*) >1) but this query removes all the data having count greater than 1.

Can someone help me with a single line query that deletes the duplicate data and resetting the count to 1.

I have table Table1 with


Post Delete it should be


Advertisement

Answer

I think this is what you are looking for

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