SELF JOIN to compare two successive rows

Hi,

I have a DB that different computers add entries to roughly every 10
seconds.
Later on I want to check “gaps”, when two entries from one computer
are further than 20 seconds apart and other things that have to do
with comparing two rows.
In MYSQL I added a new column “succ_id” for this which I increse on a
per-computer basis.
I did this to be able to find two successive rows via a JOIN-query in
MYSQL.
So I would find the rows by
SELECT t1., t2.t FROM computerdata t1 inner join computerdata t2 on
t1.succ_id=t2.succ_id-1 and t1.seconds<t2.seconds-20;
Now I’m trying to figure out how to do this “the rails way”.
The act as tree is a little bit overweighted I think and I would need
to restructure my DB as I don’t have the references to the have
antecessor.
Can anybody give me a hint?
Thanks in advance,

Martin