Web 2.0 programming using Java, Javascript, HTML, CSS, AJAX, MySQL and Struts.
Tuesday, April 17, 2007
MySQL pagination
I'm writing some pagination code for my application. Turns out MySQL has a great method for accomplishing this.
In the select statement, just end it with
LIMIT [offset,] number_of_rows
Combine this with distinct ordering via "ORDER BY" on a unique indexed key, and you have the database doing the pagination without even having to keep open a connection.
No comments:
Post a Comment