假设我有ID3,4,7,9
的记录
我希望能够通过下一个/上一个链接导航从一个到另一个.
问题是,我不知道how to fetch record with nearest higher ID.
所以,当我有一个ID4
的记录时,我需要能够获取下一个现有记录,即7
.
The query would probably look something like
SELECT * FROM foo WHERE id = 4 OFFSET 1
How can I fetch next/previous record without fetching the whole result set and manually iterating?
我使用的是MySQL 5.