Home > Database > Mysql Tutorial > body text

mysql 如何通过一个sql语句搜出比例关系

WBOY
Release: 2016-06-06 09:36:58
Original
914 people have browsed it

mysqlsql

例如 一个表格里有
商品,价格,日期 三个字段
a 10.2,20151008
a 9.2,20151009
a 7.2,20151010
b 11.2,20151008
b 10.2,20151008

我要搜 在历史上各个商品价格低于10¥的次数占该商品出现的总次数的百分比,应该如何写mysql语句呢?
谢谢了
搜出结果要类似
a 2/3
b 0/2

这样的sql语句怎么写呢?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!