假设我有下面的表
id | items | price |
1| item_1 | 15.0 |
2| item_2 | 10.0 |
3| item_1 | 15.0 |
4| item_1 | 15.0 |
5| item_2 | 10.0 |
6| item_2 | 10.0 |
7| item_3 | 25.0 |
我需要以下输出
items | price | count | sum |
item_1 | 15.0 | 3 | 45.0 |
item_2 | 10.0 | 3 | 30.9 |
item_3 | 25.0 | 1 | 25.0 |
2条答案
按热度按时间fwzugrvs1#
您必须执行如下查询,
nle07wnf2#
我们可以在这里使用解析函数: