Reputation: 6242
Have a field of type Date.
I know there is someway of getting interval of last month like, something like
NOW() - INTERVAL 1 MONTH.
What I need is:
If today is 7.4.15 then I need to select all the entries in a table which has the date field set to 8.4.XX 9.4.XX 10.4.XX - year doesn't matter!
Edit: I need also to know how to know use some day interval for searching the next 3 days.
Upvotes: 0
Views: 25
Reputation: 520
I would use something like this though it is not very efficient
select * from table where
date_format(datefield,'%m%d') between
date_format(Now() + interval 1 day,'%m%d') and date_format(Now() + interval 3 day,'%m%d');
You can probably use %j (day of year 1-366) but I am not sure how it will work for leap years.
Upvotes: 1