You should read the rest of this thread Joel.
On Wed, Oct 20, 2010 at 4:46 PM, Joel Black wrote:
>
> You can query the database to extract the records you want, then query the
> query for a total. This example actually gets the total if there are
> multiple quantity for each item
>
>
>
> SELE
You can query the database to extract the records you want, then query the
query for a total. This example actually gets the total if there are multiple
quantity for each item
SELECT SUM(PriceSold*Quantity) AS TheTotal
FROM cart
~~~
Yeah that's fine, yours works too, perhaps faster, but each way should not
be noticeable unless your talking larger record sets, and then you should
scrap everything and let the DB do it.
Considering every time I need to get a total I typically need to loop around
and display the items anyways, I
I'd have to respectfully disagree. I think you'll find the way I proposed in
the other branch of this question is about 5 times faster than using query
of query.
QoQ is generally a poor choice.
Here's a test:
ArraySum: #getTickCount()-start#
SELECT SUM(intValue) as result FRO
pplication!
Thanks,
Rick
-Original Message-
From: David McGraw [mailto:david.mcg...@gmail.com]
Sent: Tuesday, October 19, 2010 4:24 PM
To: cf-talk
Subject: Re: totaling items in a recordset
Actually... the best way would be to use a query of queries...
SELECT SUM(prices) as result
Actually... the best way would be to use a query of queries...
SELECT SUM(prices) as result FROM
query
#priceTotal.result#
Again this is all assuming you don't want just the total and still need the
individual items from the DB.
Regards,
David McGraw
Oyova Software, LLC
http://www.oyova.com
SUM()
On Tue, Oct 19, 2010 at 2:18 PM, Rick Sanders wrote:
>
> Hey all. I am pulling prices from a database and want to total them. Is
> there a function like #total(query.column)# ?
>
> Kind Regards,
>
>
> Rick Sanders
> Webenergy Software
> 902-401-7689
> http://www.webenergy.ca
>
>
>
>
>
>
>
Hey all. I am pulling prices from a database and want to total them. Is
there a function like #total(query.column)# ?
Kind Regards,
Rick Sanders
Webenergy Software
902-401-7689
http://www.webenergy.ca
~|
Order the Adobe
8 matches
Mail list logo