我有一个包含 3 列的表格:Category、Seller、Sales
catgeory seller Sales
a ab 1654
a bc 1656
a cd 1136
a da 1421
a ef 1309
a gh 1624
b cd 1754
b hj 1542
b kl 1925
b mn 1915
c op 1912
c ab 1335
c de 1079
c pq 1316
d ag 1890
d df 1817
我只想要在每个类别中贡献前 40% 销售额的卖家列表。使用 Mysql 查询。有什么想法吗?
最佳答案
我想这应该是这样的:
select seller
from table
where sales IN (
select max(sales)
from table
group by category)
关于mysql - 如何从每个类别中获得前 40% 的销售贡献者?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27896374/