Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help on Query to identify Dates sequence

Status
Not open for further replies.

rohithrn

Programmer
Apr 3, 2008
5
US
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!!

 
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.
 
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. . .
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top