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

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

WBOY
WBOYOriginal
2016-06-06 09:36:58914browse

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语句怎么写呢?

Statement:
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