Hi
Can anyone come up with a neat where statement to catch overlapping date ranges. My table has a from and to date eg.
ID F_FromDate F_ToDate
1 1-Mar-2008 18-Mar-2008
2 1-Jan-2000 31-Dec-2010
3 10-Mar-2008 01-Apr-2008
4 13-Mar-2008 15-Mar-2008
5 1-Jan-2008 01-Mar-2008
6 25-Mar-2008 09-Sep-2008
My input parameters @datFromDate and @datToDate may be for example
8-Mar-2008 and 23-Mar-2008
in which case they overlap with and return records 1 to 4 and not 5/6.
My clumsy code involves three 'OR's.
Any suggestions?
Can anyone come up with a neat where statement to catch overlapping date ranges. My table has a from and to date eg.
ID F_FromDate F_ToDate
1 1-Mar-2008 18-Mar-2008
2 1-Jan-2000 31-Dec-2010
3 10-Mar-2008 01-Apr-2008
4 13-Mar-2008 15-Mar-2008
5 1-Jan-2008 01-Mar-2008
6 25-Mar-2008 09-Sep-2008
My input parameters @datFromDate and @datToDate may be for example
8-Mar-2008 and 23-Mar-2008
in which case they overlap with and return records 1 to 4 and not 5/6.
My clumsy code involves three 'OR's.
Any suggestions?