Friday, July 9, 2010

Select previous and next row from a Mysql table

Previous ID:
SELECT id FROM $mytable WHERE id < $id ORDER BY ID DESC LIMIT 1;
Next ID:
SELECT id FROM $mytable WHERE id > $id ORDER BY ID ASC LIMIT 1;
(thanks to Bob Field)

No comments:

Post a Comment

Manage Vtiger Menu

How Manage and customize Vtiger Menu You need to modify the function getAppMenuList in the f...