Quantcast
Channel: User Duncan - Stack Overflow
Viewing all articles
Browse latest Browse all 24

Remove duplicate entries from database with conditions

$
0
0

I've had a good look around but havnt been able to find a solution so hoping someone can help with this one.

I have a MySQL table of results from an internal logging application which records a result from a check routine, there are a number of check routines which are identified with the tracker column:

id (int)(PK), tracker (int), time (timestamp), result (int)

A result only needs to be recorded if the previous result is not the same, only changes need to be captured. Unfortunatly this was ignored when it was built (in a hurry) a month ago and results have been recorded blindly with no checks on previous results. This has now been recorded but I'm still left with a few thousand rows of which a significant number are duplicate entries and I'm after a way of clearing these out to just leave the change points.

So I need to go through each row, look at the previous result recorded by that tracker and delete the row if its the same, this is a bit beyond my experience with MySQL and the attempts I've made so far have been fairly poor!

Can anyone help?


Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>