Simply do it like with math fields:
SELECT count(*) WHERE order_column < '$mid_row_value'

Marco Bleeker wrote:

At 15:38 20-11-02 +0100, you wrote:

I don't think this can be done without ordering the selection first. Then you can do it:
1. you need to find out the value your middle row has in the order column,
2. count rows with smaller value in the order column than your middle row, this is its offset
3. now you can (using the offset) select 20 rows before and after, but you must order your selection by the order column

Thank you Marek. Next problem: My order column is a string field. Would there be a MySQL function to compare string fields like with a if(A < B) - you would do with numeric fields?

Thanks, Marco (not on the list anymore, please answer to private address)



Marco Bleeker wrote:

And how would I find out which portion (row number) the row would be in, that I would like to see in a listing?

<Q>
Hello, how would I go about listing a portion of a MySQL table, without an overall selection criterium? I have a unique index field, but it's a string and not autoincremented (but manually and with gaps). I just want to go to one particular row (query on that index field) and then list, say, 20 rows before that point and 20 rows after it. So I can create an output of 41 rows in a HTML table. Is there something like the dBase SKIP and GOTO command? Should I do a query for each individual row (and get 41 result sets) or can I somehow walk through 1 result set ?
</Q>

Thanks, Marco
--
Marco Bleeker, Amsterdam, NL.
Please do not distribute my email address to a third party
Refer to www.ecocam.com for an email form (and more)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to