Andrew,

To add to what Adam said, you can even do:

select 
        *, (select count(*) from table) as totalRecords
from
        table

To grab the total number of records as a column. 

NOTE: You want to try to avoid using "*" in your select statements--I'm
using it for brevity.

-Dan

>-----Original Message-----
>From: Adam Churvis [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 28, 2006 11:46 PM
>To: CF-Talk
>Subject: Re: DB Pagination Question
>
>Andrew,
>
>Don't use RecordCount on a query that returns the actual rows.  Instead,
>perform a query that just returns the Count(*) of the rows that would
>satisfy your WHERE clause.  It's much more performant and requires a lot
>less of your server resources.
>Respectfully,
>
>Adam Phillip Churvis
>Certified Advanced ColdFusion MX 7 Developer
>BlueDragon Alliance Founding Committee
>
>
>
>Get advanced intensive Master-level training in
>C# & ASP.NET 2.0 for ColdFusion Developers at
>ProductivityEnhancement.com
>
>  ----- Original Message -----
>  From: Andrew Grosset
>  To: CF-Talk
>  Sent: Tuesday, March 28, 2006 8:53 PM
>  Subject: Re: DB Pagination Question
>
>
>  Dan, thanks for posting. Presumably you need to do another query
>initially to determine how many pages potentially to display dependent on
>the recordcount? (ie if there were 1000 records (recordcount?) and you
>elected to display 10 records/page that would be 100 pages).


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236390
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to