Actually, in MySQL, LIMIT does exactly what you want, but the syntax is a little different. LIMIT can take 1 or 2 arguments:
1 arg: LIMIT [number of rows] 2 args: LIMIT [offset row],[number of rows] So: SELECT * FROM table LIMIT 49,100; returns 100 rows starting with the 50th in the database (table rows start at 0, so you must account for the offset) SELECT * FROM table LIMIT 5; returns the first 5 rows in the table. SELECT * FROM table LIMIT 4,1; returns only the fifth row (table rows start at 0, so you must account for the offset) >>-----Original Message----- >>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >>Sent: Monday, October 15, 2001 6:20 PM >>To: JRun-Talk >>Subject: RE: RE: SQL >> >> >>ms sql is TOP, >> >>SELECT TOP 50 * FROM Table >> >>mysql is limit.. >>SELECT * FROM Table LIMIT 50,100 >>returns rows 50 to 100. >> >>Travis >> >>---- Original Message ---- >>From: "McAuliffe, Kreighan" <[EMAIL PROTECTED]> >>Sent: 2001-10-15 15:12:40.0 >>To: JRun-Talk <[EMAIL PROTECTED]> >>Subject: RE: SQL >> >>Check out the "set rowcount" command in the SQL >>documentation for the >>database you are using. For example: >> >>set rowcount 1 >>select columnName from tableName... (optional where clause >>as appropriate) >>set rowcount 0 >> >>This should cause the database engine to return only one >>row when the query >>is executed, then turn off the row restriction afterwards (else all >>subsequent queries will return only one row.) >> >>For MS SQL, you might also be able to use "select TOP ...." >> Or, in worst >>case, you could resort to using a cursor. >> >> >> >>-----Original Message----- >>From: Gregory Price [mailto:[EMAIL PROTECTED]] >>Sent: Monday, October 15, 2001 10:29 AM >>To: JRun-Talk >>Subject: OT: SQL >> >> >>does anyone know how to get a single row in a select >>statement in sql >>say I want to grab the 5th row in some table regardless of >>its contense, >>i just want the 5th record >>any help is appreciated! >>Thanks >>Greg Price >> >> >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Get the mailserver that powers this list at http://www.coolfusion.com Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
