Actually, yes there is a concept here of overlapping. I used your query and it did not work for all cases. I went on Oracles website and found the answer there. Here is the link:

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"?

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
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:
............................................. 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


In reply to Re^2: Overlapping dates Issue by data67
in thread Overlapping dates Issue by data67

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.