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!!
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!!