|
|
Question : Find the Minimum Date From and Maximium Date To from a list of continious Time Periods
|
|
I have the following data:
RecID Member DateFrom DateTo ----------- ------ ------------------------------------------------------ ------------------------------------------------------ 1 01 2005-01-01 00:00:00.000 2005-01-31 00:00:00.000 2 01 2005-02-01 00:00:00.000 2005-02-28 00:00:00.000 3 01 2005-03-01 00:00:00.000 2005-03-31 00:00:00.000 4 01 2005-06-01 00:00:00.000 2005-06-30 00:00:00.000 5 01 2005-07-01 00:00:00.000 2005-07-31 00:00:00.000
I need to pull the Minimum DateFrom and Maximum DateTo for each continious span. A Continoius span is defined as the DateFrom of the Record is one day more than the preceding DateTo
Output for this DataSet should be
MEmber DateFrom DateTo ------ ------------------------------------------------------ ------------------------------------------------------ 01 2005-01-01 00:00:00.000 2005-3-31 00:00:00.00 01 2005-06-01 00:00:00.000 2005-7-31 00:00:00.00
Thank you in advance
|
Answer : Find the Minimum Date From and Maximium Date To from a list of continious Time Periods
|
|
I don't think so. The reason is that to determine continuous span you have to compare the DateFrom of row n+1 to the DateTo of row n. SQL does not provide any row level operations.
|
|
|
|