I am using this code:
WHERE date > DATE_SUB(CURDATE(), INTERVAL 3 DAY)
And result will be like this:
2022-05-12
2022-05-11
2022-05-10
But I want this:
2022-05-11
2022-05-10
2022-05-09
CodePudding user response:
Use a range here:
WHERE date < CURDATE() AND date >= DATE_SUB(CURDATE(), INTERVAL 3 DAY)
Assuming today's date be 2022-05-12
, the above logic would exclude this date but include the three previous days, from 11th May to 9th May.