一、分组求和
SELECT col1, col2, SUM(col3)
FROM table_name
GROUP BY col1, col2;
二、分组求和后再求和
SELECT SUM(subquery.sum_amount) AS total_amount
FROM (
SELECT order_status, order_date, SUM(order_amount) AS sum_amount
FROM order_table
GROUP BY order_status, order_date
) AS subquery;