Stuart McLachlan
stuart at lexacorp.com.pg
Fri May 6 19:42:11 CDT 2005
On 6 May 2005 at 10:43, Joe Rojas wrote: > Hi All, > > How do sites like eBay show only X number of items at a time and allow users > to jump to a page number or click next? > > Is there a SQL statement that allows you to select the 2nd > (3rd,4th,5th,...)set of X number of records in a database? > If they are using MySQL they will be using the LIMIT command </quote> The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must be integer constants. With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1): mysql> SELECT * FROM table LIMIT 5,10; # Retrieve rows 6-15 </quote> -- Stuart