Here is a problem I haven't been able to solve:

I have a table with a index on a column (e.g. "code").

When I want to look for the code after "LLLL" (for
instance) I do:

select MIN(code) from table where code>"LLLL"

This will be very fast (one value only is checked).

But when I want to llok for the code before:

select MAX(code) from table where code<"LLLL"

This will check all codes before "LLLL" and it'll be
very slow with big tables.

Does anyone know how to solve this? Is there another
function I should use instead of "MAX"?

Thanks for your replies.




__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to