I am stuck on how to go about this so I am looking to get some suggestions from fellow board members.
Basically I am trying to make a simple event list that shows the next two days of events that are upcoming. Some events happen every year on the same day (holidays, and birthdays) and some events can only happen once like a meeting.
So my table looks like this:
hl_events
id INT NOT NULL AUTO_INCREMENT
event VARCHAR(255)
event_d INT(2)
event_m INT(2)
event_y INT(4)
yearly INT(1)
now my main problem is trying to come up with an SQL query that will only select the next two days of events. So if there are no events tomorrow but there are 2 events in two days and another two events in a week, it would select those.
The other problem I am trying to think around is say it is currently the end of the year but the next two events are in the next year.
Some restrictions I have are that if an event happens yearly the column "yearly" will have the value 1 and there will be no value in event_y. However, if the event only happens once then yearly will be 0 and event_y will have the year it takes place. As well, I do not want to delete any records.