Friday, March 23, 2012

Multiply Rows with T - SQL

I need to multiply rows of a table with each other. I found a function like this

exp(sum(ln(floatfield1))).

But I can not find the ln function. Is there any other possibility ?

Thanks for any help.

Uwe

in function ? is this for MS SQL Server ?

Post your table structure, some sample data and the expected result. We should be able to help you to come up with the query|||

Uwe, LOG is the natural logarithm function in SQL Server. Also, see some of the previous discussions of this question: http://groups.google.com/groups/search?q=aggregate+product+kass+sqlserver Steve Kass Drew University Uwe Helmer@.discussions.microsoft.com wrote:
> I need to multiply rows of a table with each other. I found a function
> like this
>
> exp(sum(ln(floatfield1))).
>
> But I can not find the ln function. Is there any other possibility ?
>
>
>
> Thanks for any help.
>
> Uwe
>
>

|||

In your SQL statment

exp(sum(LOG(floatfield1))).

In SQL

Constant e (2.71828182845905…) based Natural log is set as LOG and 10 based is written as LOG10.

Some examples:

LOG ( e ) = 1.0

EXP( LOG( n ) ) = n.

10 ^ LOG10(n) = n

This seelect statement

SELECT LOG (EXP (5))

returns 5.

No comments:

Post a Comment