Skip to content
Advertisement

How to delete duplicate data from MySQL except latest data

I want to delete records from mysql table

I have table like this

I am checking here if (date, url, price, hotelName) is same then remove except one

In this table you can see duplicate records is id [1,4] and [5,6]

I want to delete duplicate records from this table except latest data

After deleting this table should look like

Advertisement

Answer

If your table is not too big, this is a short and straight-forward syntax :

Anoter solution, less resource-consuming :

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