I am doing a query to see if a date range [start_date] - [end_date] overlap a month.
So far I have:
select * from my table
where (start_date, end_date) overlaps ('2000-02-01', '2000-02-28')
I need it to contain date ranges that start outside of the month but go into the month, or start in the month and go into the next month: e.g.
'2000-01-31', '2000-02-01'
'2000-02-28', '2000-03-01'
however these are not being included in the query result.
It would also be great if I could just put the datepart of the month instead of overlaps ('2000-02-01', '2000-02-28')
Any help appreciated
overlapsworks on periods where the start is included, but the end is excluded (you could adjust that by adding a day to the end). What about ranges when they start before that month and end after it? Or ranges within that month?