soldat452002
Registered User.
- Local time
- Yesterday, 19:44
- Joined
- Dec 4, 2012
- Messages
- 50
Hello
So currently im working in migrating data from two Regions (East, West) same data fields but the date ranges (Eff, Exp) either could overlap or not. Im trying to build a query to identify overlapping dates and insert them in order (Oldest to Newest date). Any help would be appreciated it.
The desired result would be to Insert a record with oldest date prior to the next record with the newest date.
My current query.
So currently im working in migrating data from two Regions (East, West) same data fields but the date ranges (Eff, Exp) either could overlap or not. Im trying to build a query to identify overlapping dates and insert them in order (Oldest to Newest date). Any help would be appreciated it.
The desired result would be to Insert a record with oldest date prior to the next record with the newest date.
My current query.
- [East].[Eff] >= [West].[Exp]
- [East].[Exp] <= [West].[eff]
- [East].[Affiliation_ID] = [West].[affiliation_ID]
- [East].[ID] = [West].[ID]
Id | West.Eff | West.Exp | West.Code | West.Affiliation_ID | East.Eff | East.Exp | East.Code | East.Affiliation_ID |
---|---|---|---|---|---|---|---|---|
19267717 | 3/4/2020 | 1/1/2200 | TMUTUAL | 2971515 | 10/17/2019 | 3/3/2020 | COMPLETE | 2971515 |
19267717 | 3/4/2020 | 1/1/2200 | TMUTUAL | 2971515 | 3/4/2020 | 1/1/2200 | TMUTUAL | 2971515 |
19313290 | 12/6/2019 | 1/1/2200 | COMPLETE | 2971515 | 11/27/2019 | 1/12/2020 | COMPLETE | 2971515 |
19313290 | 12/6/2019 | 1/1/2200 | COMPLETE | 2971515 | 1/13/2020 | 1/1/2200 | TMUTUAL | 2971515 |