Scott Haneda wrote:
[...]
Is perhaps there some way to get the next id and prev id in a mysql query
based on id being sorted?

You could do this using LIMIT. For example:


SELECT id FROM foo WHERE id > $current_id ORDER BY id ASC LIMIT 1;
SELECT id FROM foo WHERE id < $current_id ORDER BY id DESC LIMIT 1;

If the result is empty, you'll know you have to wrap to the first/last entry.

Hans-Peter





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



Reply via email to