我需要做一个简单的postgresql查询,但我不是Maven。我有一张显示销售额的表:我需要显示每个卖家每天卖出多少。这是我需要的结果:我检查了这个问题,但我也需要按日期分组。我试过了,但我得不到我需要的:
SELECT seller, date, sum(amount) AS amount FROM sales GROUP BY seller, date, amount ORDER BY seller;
bnl4lu3b1#
假设您希望将每个卖家每天的金额分组,sql应该如下所示。
SELECT seller, date, sum(amount) AS amount FROM sales GROUP BY seller, date ORDER BY date, seller;
cwtwac6a2#
SELECT seller, date, sum(amount) AS amount FROM sales GROUP BY seller, date ORDER BY seller,date;
2条答案
按热度按时间bnl4lu3b1#
假设您希望将每个卖家每天的金额分组,sql应该如下所示。
cwtwac6a2#