Getting Record Count

2013-01-26 Thread Rick Faircloth

If I'm running a query on a database
and limit the records returned to 10,
what's the best way to get the record count
for the entire dataset if everything was
return and not just the first 10 records?

I can re-rerun the query without the 10-record
limit, but that seems like a ridiculous
approach, just to get the record count.

Suggestions!

Thanks,

Rick



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354082
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Getting Record Count

2013-01-26 Thread Brian Thornton

Do a first quesrt using sql count
On Jan 26, 2013 12:41 PM, Rick Faircloth r...@whitestonemedia.com wrote:


 If I'm running a query on a database
 and limit the records returned to 10,
 what's the best way to get the record count
 for the entire dataset if everything was
 return and not just the first 10 records?

 I can re-rerun the query without the 10-record
 limit, but that seems like a ridiculous
 approach, just to get the record count.

 Suggestions!

 Thanks,

 Rick



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354083
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Getting Record Count

2013-01-26 Thread Gerald Guido

Something like this perhaps?

SELECThelp_topic_id , (SELECT count(help_topic_id)   FROM
mysql.help_relation )   as IDCount,help_keyword_id FROM
mysql.help_relation

LIMIT 10;


On Sat, Jan 26, 2013 at 12:41 PM, Rick Faircloth
r...@whitestonemedia.comwrote:


 If I'm running a query on a database
 and limit the records returned to 10,
 what's the best way to get the record count
 for the entire dataset if everything was
 return and not just the first 10 records?

 I can re-rerun the query without the 10-record
 limit, but that seems like a ridiculous
 approach, just to get the record count.

 Suggestions!

 Thanks,

 Rick



 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354084
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Getting Record Count

2013-01-26 Thread Rick Faircloth

That worked! Learn something new every day!
Thanks, Gerald and Brian for the tips!

Rick

-Original Message-
From: Gerald Guido [mailto:gerald.gu...@gmail.com] 
Sent: Saturday, January 26, 2013 5:45 PM
To: cf-talk
Subject: Re: Getting Record Count


Something like this perhaps?

SELECThelp_topic_id , (SELECT count(help_topic_id)   FROM
mysql.help_relation )   as IDCount,help_keyword_id FROM
mysql.help_relation

LIMIT 10;


On Sat, Jan 26, 2013 at 12:41 PM, Rick Faircloth
r...@whitestonemedia.comwrote:


 If I'm running a query on a database
 and limit the records returned to 10,
 what's the best way to get the record count
 for the entire dataset if everything was
 return and not just the first 10 records?

 I can re-rerun the query without the 10-record
 limit, but that seems like a ridiculous
 approach, just to get the record count.

 Suggestions!

 Thanks,

 Rick



 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354085
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm