Reproduced by killilll. Where does the aggregate function of the product calculated by Feige chuanshu go?
Very depressing. The stupid Excel product function can be used to calculate the product of a column, but Oracle and SQL Server do not. It seems that MySQL does not.
After reading about asktom, it seems that I want to write a function of the product myself, which is depressing.
Suddenly, my colleague proposed to change it, but multiplication is already the most basic four rule. Do you want to convert it into addition ?! @_@
This colleague suggested that we could use exponential and logarithm transformation and multiplication, as shown below:
Download: http://www.freeeim.com/
Oracle and SQL server have ready-made functions such as the index and (natural) Logarithm. Why is there no product?
Do not understand.
Back to the question, the final SQL statement becomes like this:
ORACLE:
View sourceprint? 1 select exp (sum (Ln (field_name) from table_name;
SQL Server:
View sourceprint? 1 select exp (sum (log (field_name) from table_name;
I flipped through SQL hacks and found that 24th hack is to describe this problem. We recommend that you read this book to make sure that SQL is never simple.
BTW: The book has been downloaded from the English version of CHM and released in the Chinese version, but the Chinese version of book reviews are not bad.