Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Help on Query to identify Dates sequence

Help on Query to identify Dates sequence

Help on Query to identify Dates sequence

I'm working on a DB2 query to identify the date sequence and to filter out any sub sets of date ranges.

I really appreciate any help on this.

This is how I have data in a view.

ID        Begin Date      End Date
140721    6/26/2010    12/31/2010 <--
140721    7/31/2010    8/27/2010
140721    9/25/2010    10/8/2010
140721    10/9/2010    10/29/2010
140721    11/27/2010    12/31/2010
140721    1/1/2011    7/1/2011   <--
140721    1/1/2011    1/28/2011
140721    1/29/2011    2/25/2011
140721    2/2/2011    2/10/2011
140721    2/26/2011    3/18/2011
140721    3/19/2011    4/1/2011
140721    4/2/2011    4/29/2011
140721    4/30/2011    5/13/2011
140721    5/14/2011    5/27/2011
140721    5/28/2011    7/1/2011
140721    7/2/2011    12/30/2011 <--
140721    7/2/2011    8/26/2011
140721    8/6/2011    8/12/2011
140721    8/27/2011    9/30/2011
140721    10/1/2011    10/28/2011
140721    1/28/2012    2/3/2012   <--

I want the output of the query to show only those rows which I have marked with "<--" symbol.

Can someone please provide me with any ideas on how to write appropriate query for this? Thanks!!


RE: Help on Query to identify Dates sequence

Until you post the "rules" for selecting these rows, it will be difficule to help you. . .

Unless the dates to select will always be the same. Typically, the dates would change from time to time.

RE: Help on Query to identify Dates sequence

If you had posted the necessary information here, you might have gotten a usable reply/answer. . .

The only clue you posted was the <-- value. You never did explain the rules about the entries to be skipped. . .

RE: Help on Query to identify Dates sequence

In Rohit's defence, the other forum was a little quicker to reply than us (which is a surprise). He had got answer in the other forum before we'd replied.

That said, Papa is quite correct, the post needed more information.

Well done Rohit in getting it solved.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close