Where does the aggregate function of the product calculated by Feige chuanshu go?

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.