I have a list of periods during a year, and they are the same every year. You can think of it as a Season. They have a startDate and a endDate.
Because there can be Seasons that leap each other, what I need to to is query all the matching Seasons given a date, no matter what year.
As an example:
Season1: from 1st of January to 10th of January Season2: from 6th of January to 8th of January Season3: from 11th of January to 20th of January
Given the date 7th of January, I'd need to retrieve the Season1 and Season2.
I've tried converting all dates to the same year, but It doesn't work when the Start Date of a season in "later" than the End Date (for example, there's a period starting on November and ending of February).
Thanks in advance for the help.
Edit, sample data:
StartDate EndDate SeasonId 2000-08-01 2000-08-31 4 2000-12-29 2000-01-02 3 2000-06-01 2000-07-30 3 2000-09-01 2000-09-30 3 2000-01-06 2000-01-08 3 2000-04-07 2000-04-17 3 2000-04-28 2000-05-01 3 2000-06-02 2000-06-05 3 2000-06-23 2000-06-25 3 2000-09-08 2000-09-11 3 2000-09-22 2000-09-25 3 2000-10-12 2000-10-15 3 2000-11-01 2000-11-05 3 2000-12-01 2000-12-10 3 2000-12-22 2000-12-26 3 2000-03-01 2000-05-31 2 2000-10-01 2000-10-31 2 2000-11-01 2000-02-28 1 And I'd need, for example, the season for the date 2000-02-08, and retrieve seasonId = 1, or the date 2000-10-13and retrive seasonId = 3, seasonId = 2
2000-11-01 2000-02-28 1is supposed to be from november to february?