Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to multiply values in one field together 1

Status
Not open for further replies.

psarros

MIS
Feb 17, 2002
67
US
I have a query with user defined conditions, that I want to multiply one fields results for each record.

I want to do this using code.

qrytest
fld1 fld2
a 1.02
b 0.97
c 1.21

What is the code that will calculate 1.02 * 0.97 *1.21

TIA
 
A pure SQL solution (provided fld2 is always positive, if not let me know):
SELECT Exp(Sum(Log([fld2]))) As Result FROM qrytest

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks that works great, but how would I do it without using SQL?

Thanks
 
not to be begrudging, but since the originbal post was SPECIFIC ti the multiplication of the set of values in a field of a query -NAD - that specific answer was provided and you mention that is works well, why do then need a different soloution?





MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top