How can mysql find the proportional relationship through an SQL statement?

Source: Internet
Author: User
For example, a table contains three fields: product, price, and date: a10.2, 20151008a9. 2, 20151009a7. 2, 20151010b11. 2, 20151008b10. 2. how do I write mysql statements when I search for the percentage of the total number of times that the price of each product in history is less than 10 ¥? Thanks for the results. how can I write SQL statements like a23b02? Mysqlsql

For example, a table contains
Product, price, and date fields
A 10.2, 20151008
A 9.2, 20151009
A 7.2, 20151010
B 11.2, 20151008
B 10.2, 20151008

How can I write mysql statements when I search for the percentage of the number of times that the price of each product is less than 10 ¥ in history to the total number of times that the product appears?
Thank you.
Search results should be similar
A 2/3
B 0/2

How to write such SQL statements?

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.