On 3/29/03 7:55 AM, "Marc Bakker" <[EMAIL PROTECTED]> wrote:

> Hello,
> I am working on a PHP/MySQL/Apache website.  I have a MySQL table with 5
> rows. I want to select a patricular row using it's absolute row number. How
> can I do this? I found mysql_row_seek() n te MySQL docs but this requires me
> to get the whole table and then lets me within the result set select the
> desired row. That's too much overhead - I want to use SQL to select a
> particular row using the row number
> 
> thanks,
> 
> Marc

Maybe I am missing something, but the fifth row is by no means an absolute
thing, depending on what you order the records by. If you refer to the order
in which the records where inserted into the table I would add an
auto_increment field or if you already have another field that needs to be
primary key add a timestamp field (but you might get identical values).

With the auto increment field you could easily do:

SELECT * FROM yourtable WHERE auto_increment_field = 5;

I am not sure how reliable you can do a (see below) and get what you want.

SELECT * FROM yourtable LIMIT 5, 1;
<http://www.mysql.com/doc/en/SELECT.html>

Sure, if you table will always contain 5 rows then it should be easy to just
add a column 'rownumber' and give each row the number you want it to have.

Cheers/h


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

Reply via email to