Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002

    Unanswered: find break in list of date spans

    I need to write some sql that would take the records below, from a table, and put together what is below that..........has anyone done that before? The goal is to bring back the spans "put together" and not include the break in the spans.........HELP!!!

    xxx 1/1/2004 3/1/2004
    xxx 3/2/2004 4/30/2004
    xxx 5/15/2004 8/3/2004
    xxx 8/4/2004 12/31/2004

    xxx 1/1/2004 4/30/2004
    xxx 5/15/2004 12/31/2004

  2. #2
    Join Date
    Jan 2004
    don't know whether this is the answer which u are seeking but you can use self join to get the output

    select a.first_date,b.second_date from table1 a,table1 b where datediff(dd,a.second_date,b.first_date)=1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts