查询截止到每个月的销售额。 -- 查询结果字段: -- 月份截止当前的累计销售额
SELECT DATE_FORMAT(order_date, '%Y-%m') AS month, SUM(total_amount) AS cumulative_sales FROM orders GROUP BY DATE_FORMAT(order_date, '%Y-%m') ORDER BY month ASC;
原文地址: https://www.cveoy.top/t/topic/b71T 著作权归作者所有。请勿转载和采集!