Thanks Everett. I got it running. One more question...anyway to just display 3.06% and 
not all extra numbers?

Robert O.

-----Original Message-----
From: Everett, Al [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 4:13 PM
To: CF-Talk
Subject: RE: percentage of hits


<cfset percentOfVisits=visits / total_visits * 100>

490 is 3.0625% of 16,000

> -----Original Message-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 15, 2002 3:59 PM
> To: CF-Talk
> Subject: percentage of hits
> 
> 
> Using SUM (I think) how can I get a percentage when comparing 
> it to a total? For example if #visits# is 490 and 
> #total_visits# is 16000. What is the code to extract the 
> percentage of 490 out of 16000?
> 
> Below is part of my code:
> 
> <cfquery name="getsomedata" datasource="log_stats">
> select url, count(url) as 'visits' from log_data
> group by url
> order by visits desc
> </cfquery> 
> 
> <cfquery name="datacount" datasource="log_stats">
> Select Count(*) AS total_count FROM log_data
> </cfquery>
> 
> <cfoutput query="datacount">#total_count#</cfoutput>
> 
> Thanks.
> 
> Robert Orlini
> HWW
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to