AFAIK databases like mysql usually dont (and cant) guarantee that they will maintain the order of rows the same way they were inserted - it's that whole 'relational' thing, methinks.
the official way would be to simply add a timestamp field (which gets filled automagically every time you insert something into that table), and order by that. hacking up a little perl-script that simply iterates over all rows, and inserts a "row number" would be trivial, and should usually work, but mysql is not obligated to maintain that order (i think)


cheers,

M.

Matthew Richardson wrote:

Hello all,

Still a newbie with MySQL, I am running version 4.01 and a Linux box. We are writing information
into the tables at a regular rate approx 20 time per hour. with 22 rows of information.


What I am trying to work out is how to read the last 22 rows of information that has been written to
the Database.


Select (count(*)-22) from Database
will return me the record number 22 numbers from the very last record. This is great but
when I try and incoperate the (count(*)-22) into a query I get responce about grouping.


Just wondering if any one else has had a need to return the last few rows in a table that might be able to shed some light on the subject !

regards Matthew Richardson




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to