HI all, I have been trying to figuare out a way to fix a problem that i have been having in my perl code. The issue is that i have to make a call to the table and check for the existance of overlapping dates before i insert a row in my table.

I know some people will suggest "Date::Calc" etc but i wanted to somehow just do this check in my sql call and save time (instead of reading each row and running a date::calc on it). how can i do this? is there a simpler way to do a range check? (maybe with SQL and/or/between? I think between wont work because i have to check 2 dates against 2 params in my program? i donno?)

I want to check that there is no overlapping row in the table where the effective date & expiration date overlap. think of this like a scheduling system where i cant book an appointment over another. here is what my table look like:

Table: Company_relationship company_number relationship_type effective_date expiration_date

In reply to 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.