You should use the SQL to grab the variable
SELECT SUM(fieldname) WHERE variety = 'parameter' AS variabletouse

which is much easier than building a lot of constructs to loop and total the
data. hmm which makes me wonder can you do:
SELECT AVERAGE(fieldname) WHERE var = 'param' AS soandso

If former then do <CFSET average = variabletouse/queryname.recordcount>
and numberformat it.

Sorry if that didnt get you any further. The formula you need is complex and
a little bit hard to visualize..

Where is Dave Watts when you need him?


----- Original Message -----
From: Deanna L. Schneider <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 26, 2000 7:48 AM
Subject: Re: grouping with math functions


> What I want is the to get all the trials that have BOTH variety 1 and
> variety 2 (chosen by the user) and that also meet the state and year
> criteria (also chosen by the user). Then, I need to determine the average
> yield by variety, and figure out the percent of variety one, by variety
two
> for each "stand age". I'm getting the "raw" data that I need with my
> plethora of queries - i.e. I'm limiting the data to only those trials that
> involve both varieties and meet state and year criteria, and I'm getting
the
> avg yield for each variety by stand age. What I can't figure out how to do
> is to get the results set to variables that I can then divide by each
other.
>
> For example, I'd like to be able to say:
>
> <cfoutput>
> <cfset "variety1standage1" = yieldage> <---How do I tell it "which"
> yieldage?
> <cfset "variety2standage1" = yieldage>
> <cfset "percentyield" = variety1standage1/variety2standage1 * 100>
> </cfoutput>
>
> But, I can't figure out how to set the variables correctly while using the
> implicit loop. (i.e. is there a counter to tell me which variety is being
> outputted at a specific time?)
>
> By the way, John: thanks, but variety is just the name of the variety, not
> the yield.
>
> Make sense?
>
> I know there's probably an easier way to do the sql, but I got my head
stuck
> in this trap, and I haven't been able to figure out the sql. This isn't a
> site where they're worried about speedy performance, so it's not a huge
> issue.
>
> thanks,
> d
>
>
>
>
> ************************************************************
> Deanna Schneider
> Interactive Media Developer
> UWEX Cooperative Extension Electronic Publishing Group
> 103 Extension Bldg
> 432 N. Lake Street
> Madison, WI 53706
> (608) 265-7923
>
>
>
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
>

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to