> I have a table something like this:
> __________
> | id | number |
> | 1 |       1     |
> | 2 |      23    |
> | 3 |      59    |
> | 4 |     103   |
> 
> If I have a number, say 30, I need to get the last number it's above - 
> in this case id 2.  Any ideas?

$number = 30;
SELECT id FROM table WHERE number < $number ORDER BY number DESC LIMIT 1;

---John Holmes...

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

Reply via email to