I would like to calculate the total order amount for the previous week.
I received a request for data for the last 7 days from the current date.
SELECT SUM(goods_total) AS Total_Amount FROM orders
WHERE order_placed_date >= date_sub(current_date, INTERVAL 7 day);
Now, how can I get data for the previous week, except for this week.
For example, this week I made $ 15,000, and last week I made $ 14,000.
I get $ 15,000 by completing the above request.
But I do not know how to calculate the previous week.
source
share