My data in an Oracle table is like this. I need a solution in Oracle SQL
StDt | EdDt | User Stat |
---|---|---|
20-12-2021 | 12-06-2022 | A |
16-06-2022 | 31-12-4712 | A |
09-06-2022 | 30-06-2022 | B |
OUTPUT :-
StDt | EdDt |
---|---|
20-12-2021 | 31-12-4712 |
This output is because the person was active throughout the time till 31-12-4712.
Another Scenario :-
StDt | EdDt | User Stat |
---|---|---|
20-12-2021 | 31-12-4712 | A |
09-06-2022 | 30-06-2022 | B |
Output :-
StDt | EdDt |
---|---|
20-12-2021 | 31-12-4712 |
Another Scenario :-
StDt | EdDt | User Stat |
---|---|---|
20-12-2021 | 12-06-2022 | A |
16-06-2022 | 25-06-2022 | A |
20-06-2022 | 30-06-2022 | B |
10-10-2022 | 31-03-2023 | B |
Output :-
StDt | EdDt |
---|---|
20-12-2021 | 12-06-2022 |
16-06-2022 | 30-06-2022 |
10-10-2022 | 31-03-2022 |
So in short we have to remove the overlapping date range here.