Also, it's nifty to do this in your SQL query and avoid the overhead in CF 
entirely, so long as your query is returning the desired rows.  In MySQL it 
would be something like

<cfquery name="getData">
SELECT SUM(rev) AS revsum, MAX(rev) AS revmax, MIN(rev) AS revmin, 
othercolumns FROM table WHERE whereclause
</cfquery>

Then on your cf page, #getData.revsum#, #getData.revmax#, #getData.revmin# 
will give you the desired output.

-- Josh




----- Original Message ----- 
From: "Peterson, Chris" <[EMAIL PROTECTED]>
To: "CF-Talk" <[email protected]>
Sent: Tuesday, July 25, 2006 11:34 AM
Subject: Cool feature I didn't know about


> Most of you probably know this, but I thought I would share because I
> will use this all the time.
>
> How often do you need to output a total line at the bottom of a report?
> You probably do one of 2 things:  1) Increment a variable while
> outputting your query, or b) perform a query of queries.
>
> I found this trolling online and needed to share, lets say you have a
> query called 'getData' and a column named 'rev' and you needed a total.
> Just do this:   #arraySum(getData['rev'])#  You can use any array
> functions (avg, max, min) against a query column referenced like this.
> This seems a lot easier to read to me too!
>
> Chris Peterson
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:247655
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to