(
)perl -e "print scalar gmtime(0);" Thu Jan 1 00:00:00 1970
If so, and if (and that's an enormous if) the timestamps are always exactly 5 minutes apart, you could change the sub-select clause to
Otherwise, the sub-select for the previous-in-time row will have to do.old.timestamp = new.timestamp - 300
If your tables had an ID column that automatically incremented by one for each row*, the sub-select could be replaced by 'old.id = new.id - 1' as in the MySQL Cookbook examples.
*Of course that assumes that rows are never inserted out of order, like when the network connection drops for a few hours and you have to go back later and add the missing data . . .
In reply to Re^5: (OT) Dearest Monks - Mysql Question - Compare current insert record with last record inserted.
by keszler
in thread (OT) Dearest Monks - Mysql Question - Compare current insert record with last record inserted.
by jdlev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |