I have a table called ‘prices with the following structure:
‘id’, ‘price, ‘availability_id’ and ‘rate_id’.
When the user made changes new records were written rather than updating existing records. What I need to do is remove duplicate records with matching ‘availability_id’ and ‘rate_id’, keeping only the record with the highest ‘id’.
I have managed to list the duplicates using the following MySQL:
select 'id',
`availability_id`,
`rate_id`,
count(*)
from prices
group by 'id',
`availability_id`,
`rate_id`
having count(*) > 1
I would really appreciate any advice on removing these duplicates.
How about something like this: