OK, I'm writing this from my head so don't complain if it doesn't work Test every step below in some phpmyadmin or similar program to see if it gives correct results.
We need to find the first day of the next month (should return something like 2010-04-01):
Code:
select DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY)
And the first day of the month following the next month (2010-05-01):
Code:
select DATE_ADD(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY), INTERVAL 1 MONTH)
Now we just need to select dates between those two dates (+ convert it to unix timestamp), so the result should be something like this:
Code:
event_date >= UNIX_TIMESTAMP(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY)) AND event_date < DATE_ADD(DATE_ADD(LAST_DAY(NOW()), INTERVAL 1 DAY), INTERVAL 1 MONTH))
Bookmarks