MySQL Forums
Forum List  »  Newbie

Compare row 1 with row 2
Posted by: Ronnie Pettersson
Date: January 24, 2006 09:30PM

I have a table with data that is supposed to only increase in value, but due to bugs outside my control, I need to check the entries in the database on a periodic basis.

I can of course do this in a scripting language like php but I was wondering if there is a way to do it in MySQL with some kind of SELECT query reducing the server load?

the table looks like:
id auto_increment
timestamp
data (numeric value that will increase with time)

What I'm looking for is something like this
SELECT id FROM table WHERE data is less than previous row's data ORDER BY timestamp

/Ronnie

Options: ReplyQuote


Subject
Written By
Posted
Compare row 1 with row 2
January 24, 2006 09:30PM
January 25, 2006 02:59AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.