The following query selects the rows that I want to delete-
select bad_rows.* from products as bad_rows inner join ( select pid, MAX(last_updated_date) as maxdate from products group by pid having count(*) > 1 ) as good_rows on good_rows.pid= bad_rows.pid and good_rows.maxdate <> bad_rows.last_updated_date;
Now to actually delete them I tried changing the first word - 'select' to 'delete', but in this case the query seems to run forever and no rows are deleted. Why ?
How else can these rows be deleted?
btw what I am trying to do is get rid of duplicates. the selelct query works just fine in selecting the records, all I have to do is figure out a way of deleteting them
Edited by kutchbhi, 14 May 2014 - 06:24 PM.