Hello,
I need to create the segmentation on a table. Below is the original data in the table.
Begmeasure EndMeasure DetMethod Testpressure
0 7703 Acceptable 1006
7703 32149 Acceptable 1007
8323 32149 Not Verified 1010
8323 32149 Not Verified 1010
10988 32149 Acceptable 1010
Forst row should be compared to its next row. If the next row beg and end measures are in between the first row's beg and end measures or overlaps with the first row, and first row method is " acceptable" and the test pressure is smaller, the first row segment stays as the final record. The logic has to loop through every subsequent row untill there is no overlap between the two compared rows.
As shown below, the rows 3 and 4 are elimated/replaced with 2nd row becuase the detmethod is "Not Verified". Only 2 types of methods exists in the table, "Acceptable" and "Not Verified". In this 10988 is less than 32149, So its an overlap. So, we have to segment as 7703 to 10988 and 10988 to 32149. I want the result set to be like this below:
After Segmentation :
BegMeasure EndMeasure DetMethod Testpressure
0 7703 Acceptable 1006
7703 10988 Acceptable 1007
10988 32149 Acceptable 1010
Please help me in achieving this. Thanks so much for all the help.
Thank You