bluemicrobyte
02-19-2007, 2:31 AM
So I'm trying to come up with a good cron script that removes duplicate entries in a table -- since I've given up trying to track down the source of the duplicate entries, I can settle for a simple maintenance script that removes them.
The table has one column, "name" which should be unique for every entry (except duplicates). There is another column, "time1", and also another one, "time2". I'd like to find duplicate entires in the "name" column, then delete the older one based on time1, then time2 (if time1 is the same).
Is there a simple way to do this with very few queries, maybe to the point where it would be efficient enough to include it on every page? If not I can write a less-than-efficient cron script to run every night.
The table has one column, "name" which should be unique for every entry (except duplicates). There is another column, "time1", and also another one, "time2". I'd like to find duplicate entires in the "name" column, then delete the older one based on time1, then time2 (if time1 is the same).
Is there a simple way to do this with very few queries, maybe to the point where it would be efficient enough to include it on every page? If not I can write a less-than-efficient cron script to run every night.