I have a db table that stores basic historical page view data. Each day a
task runs and inserts the date, a record of the pages viewed and a count of
how many times each was viewed. It's easy to select the most viewed pages
for a given date using:
select pname,pagehit
from tbl_log_page_count
I really should have been able to figure that out. Hopefully I'll remember
next time :) Many thanks Jochem.
- Original Message -
From: Jochem van Dieten [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Friday, May 18, 2007 12:36 PM
Subject: Re: SQL sum question
Gareth
Gareth Hughes wrote:
select pname,sum(pagehit) as pagehit
where dates between x and y
group by pname, pagehit
order by pagehit desc, pname
select pname,sum(pagehit) as pageHitCumul
where dates between x and y
group by pname
order by sum(pagehit) desc, pname
Jochem
To use SUM( ) the column in question MUST be numeric type (int, decimal,
float etc).
It doesn't have to be - this works (as long as all the rows can be cast) -
select sum (cast(Value as decimal)) as val
Regards,
Alan Ford
How can I easily nab the SUM of the inventory.service_shipping records
returned in this query via SQL? SUM blah AS cblah tosses an error, I
suppose because just one part is aggregate? Any quick ideas?
cfquery name=get_productHOLDS datasource=sddheinz
SELECT
-
From: Andrew Golden [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 8:27 AM
To: CF-Talk
Subject: Re: Quick SQL Sum Question
At 03:27 PM 8/12/2003 -0500, you wrote:
How can I easily nab the SUM of the inventory.service_shipping records
returned in this query via SQL? SUM blah
SQL Sum Question
To use SUM( ) the column in question MUST be numeric type (int, decimal,
float etc).
It doesn't have to be - this works (as long as all the rows can be cast) -
select sum (cast(Value as decimal)) as val
Regards,
Alan Ford
At 03:27 PM 8/12/2003 -0500, you wrote:
How can I easily nab the SUM of the inventory.service_shipping records
returned in this query via SQL? SUM blah AS cblah tosses an error, I
suppose because just one part is aggregate? Any quick ideas?
Have you tried SUM(blah) AS cblah? Sometimes odd
Can you post your attempt at using SUM( )?
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 2:06 PM
To: CF-Talk
Subject: RE: Quick SQL Sum Question
I need the sum...I am trying to get the total of additional shipping from
the products
-Original Message-
From: Andrew Golden [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 13, 2003 8:27 AM
To: CF-Talk
Subject: Re: Quick SQL Sum Question
At 03:27 PM 8/12/2003 -0500, you wrote:
How can I easily nab the SUM of the inventory.service_shipping records
returned in this query via
al Message-
From: Kevin Queen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 4:36 PM
To: CF-Talk
Subject: SQL SUM Question
List,
If I run the following query:
Select Number from Tbl_Numbers SUM(Number)
how can I oputput the SUMed variable in a cfoutput?
TIA,
K
List,
If I run the following query:
Select Number from Tbl_Numbers SUM(Number)
how can I oputput the SUMed variable in a cfoutput?
TIA,
Kevin Queen
~~
Structure your ColdFusion code with Fusebox. Get the official book at
Select Number from Tbl_Numbers SUM(Number) AS MyVar
cfoutput#MyVar#/Cfoutput
-Original Message-
From: Kevin Queen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 4:36 PM
To: CF-Talk
Subject: SQL SUM Question
List,
If I run the following query:
Select Number from
AIL PROTECTED]
Sent: Wednesday, January 03, 2001 3:36 PM
Subject: SQL SUM Question
List,
If I run the following query:
Select Number from Tbl_Numbers SUM(Number)
how can I oputput the SUMed variable in a cfoutput?
TIA,
Kevin Queen
~~
Structure you
You have to select it as something, for example:
select sum(number) as sum_number
from Tbl_Numbers
Regards,
Lisa Haas
The Kennedy Center
-Original Message-
From: Kevin Queen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 4:36 PM
To: CF-Talk
Subject: SQL SUM Question
select number sum(number)
from tbl_numbers
cfoutput query
#number#
I think that is right I would try it
-Original Message-
From: Kevin Queen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 4:36 PM
To: CF-Talk
Subject: SQL SUM Question
List,
If I run
Thats right I gorgot the as
-Original Message-
From: Kurt Ward [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 03, 2001 4:40 PM
To: CF-Talk
Subject: RE: SQL SUM Question
Select Number from Tbl_Numbers SUM(Number) AS MyVar
cfoutput#MyVar#/Cfoutput
-Original Message
17 matches
Mail list logo