Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2011-04-01 : 11:20:22
|
Hi,We know how to use SUM() for getting the total. But how we can achieve multiplication of some values with helping a query (not assignment select or cursor)?Is it possible to carry out with a query?For example:{1,3,5} -> 1*3*5 = 15SELECT Multiplication(value) FROM Table;______________________ |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-01 : 11:24:03
|
SELECT EXP(SUM(LOG(value))) FROM TableNote that this will cause an error if you have zeros or negative numbers, as LOG() is not defined for them. LOG() and EXP() will also return float values and may not be precise. |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
ms65g
Constraint Violating Yak Guru
497 Posts |
Posted - 2011-04-01 : 11:46:03
|
That's interesting, thanks.______________________ |
 |
|
|
|
|