In SQL Server 2005 you could use:

Page 1:
SELECT *
FROM   (SELECT ROW_NUMBER() OVER(ORDER BY person) AS 
       rownum, fname, lname FROM Emp) AS tabel1
WHERE  rownum >= 1 AND rownum <= 9 


Page 2:
SELECT *
FROM   (SELECT ROW_NUMBER() OVER(ORDER BY person) AS 
       rownum, fname, lname FROM Emp) AS tabel1
WHERE  rownum >= 10 AND rownum <= 19 


Dharmendar Kumar
Email/ Fax Communications: http://www.realmagnet.com
Web Development: http://www.daksatech.com





-----Original Message-----
From: Andy Matthews
Date: Mon, 16 Jul 2007 08:11:17 -0500
Thread:
http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:52512#283745

Depends on which database you're using.

With mySQL, you can do this:

SELECT id, name
FROM tablename
LIMIT 0,9

The 0 indicates where to start, and the 9 indicates how many records to
return. Used in conjunction 
with a URL based paging system, that query might look like this:

SELECT id, name
FROM tablename
LIMIT <cfqueryparam value="#URL.page#" cfsqltype="cf_sql_integer">,9
 

Hi

What would be the best way to only show 9 results from a DB query on a page
and then have a next 
button and show the next 9 there after, and so on.

Do I have to read the query into a structure or is there a way I can use the
<cfloop> function.


Thanks!


Internal Virus Database is out-of-date.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.1 - Release Date: 7/6/2007 12:00
AM
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283752
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to