Reputation: 299
I want to fetch all the values between followupdate = now and followupdate = now + 5days. Currently I'm using this query which is not returning today's values though it is returning the next 5 days values
SELECT * FROM leads WHERE followupdate >= NOW() AND followupdate <= NOW() + INTERVAL 5 DAY;
Upvotes: 1
Views: 1152
Reputation: 2885
You can use CURDATE()
to get today's date, then add 5 to it.
SELECT
*
FROM
leads
WHERE
followupdate >= CURDATE() AND followupdate <= DATE_ADD(CURDATE(), INTERVAL 5 DAY);
Upvotes: 0
Reputation: 9396
Try the following query:
SELECT * FROM leads WHERE followupdate >= DATE(NOW()) AND followupdate <= DATE(NOW() + INTERVAL 5 DAY);
As NOW
returns the entire timestamp use DATE()
to get today's date.
Upvotes: 2