I read how I can query between two dates here, but I'm trying to do the opposite. I have a database of events, with start days and end days. I'm trying to check to see if now() is between any start days AND end days.
Of note, my events are cyclical so I don't care about the years. To use the data format in my database I just use 2000 for everything. I have events such as the Christmas season (2000-12-01 to 2000-12-25), Independence Day (2000-06-25 to 2000-07-04), and so forth.
At first I was thinking about doing something like:
SELECT * FROM `table` WHERE MONTH(NOW()) >= MONTH(`start`) AND DATE(NOW()) >= DATE(`start`) AND MONTH(NOW()) <= MONTH(`end`) AND DATE(NOW()) <= DATE(`end`)
But then I realized a major flaw in periods of time that span multiple months. If today is 27JUN then I'd like the Independence Day row to return, but while 27 >= 25, 27 <= 4 is not the case.
I was thinking of seeing if I can convert NOW(), start, and end to a timestamp to allow me to compare them, but discounted the idea because I might have something with a start date of 2000-12-26 and an end date of 2000-01-01 (remembering that I'm ignoring the year).
Is there a better way to store month/date pairs instead of dates? Or what can I do to fix my database query?