in reply to Re: Overlapping dates Issue
in thread Overlapping dates Issue
http://asktom.oracle.com/pls/ask/f?p=4950:8:15236886734525876868::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:4921012347969,
and we said... Do you need to be concerned with all overlaps? Eg: in database you have
01-jan-2001 07-jan-2001
you are given as inputs:
15-dec-2000 15-jan-2001 - wider then database 15-dec-2000 04-jan-2001 - overlaps but not contained within 04-jan-2001 15-jan-2001 - overlaps but not contained within 02-jan-2001 04-jan-2001 - overlaps and contained within
should all four return a "hit"?
will do that. If you use the following "chart", it depicts all of the possibles and which "rule" in the predicate above will catch them:select * from t where ( c_beginning between p_beginning and p_ending -- rule 1 OR c_ending between p_beginning and p_ending -- rule 2 OR ( c_beginning < p_beginning and p_ending < c_ending ) ); -- + rule 3
............................................. CB CE PB PE -- rule 1 PB PE -- rule 1 PB PE -- rule 2 PB PE -- rule 3 PB PE -- no hit PB PE -- no hit
Thanks,
data
|
|---|