mysql - select pagination chunk that includes a given id

Posted by sean smith on Stack Overflow See other posts from Stack Overflow or by sean smith
Published on 2009-02-23T15:43:16Z Indexed on 2010/03/26 19:03 UTC
Read the original article Hit count: 394

Filed under:
|

...before the pagination chunks have been determined.

I know you can do this in multiple statements, but there must be a better way.

my results are returned ordered by date and I want to return the pagination chunk that contains a given id. So I could, for example, select the date of the given id and then select a chunk of results where date is less than or greater than the date. That would work. But is there some native mysql method of doing this sort of thing in one statement? It just seems reasonable to expect that we could ask for X results in which a given id exists if results are ordered by date.

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database