SELECT customer_id, SUM(amount) AS Total_Amount
FROM transactions
WHERE transaction_date <= LAST_DAY('2023-09-01')
GROUP BY customer_id;