I am using this code:
JavaScript
x
WHERE date > DATE_SUB(CURDATE(), INTERVAL 3 DAY)
And result will be like this:
JavaScript
2022-05-12
2022-05-11
2022-05-10
But I want this:
JavaScript
2022-05-11
2022-05-10
2022-05-09
Advertisement
Answer
Use a range here:
JavaScript
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.