SELECT MONTH(order_date) AS month, YEAR(order_date) AS year, SUM(order_total) as total, AVG(order_total) AS avg_total
FROM orders
GROUP BY MONTH(order_date), YEAR(order_date)
ORDER BY YEAR(order_date) DESC, MONTH(order_date) DESC
SQL Combine multiple aggregates and group by month
Demonstrates grouping results by month and year.
