Table Location (LocId, StartDt,EndDt) has incorrect EndDt. The second table is how it should look. The location table is in prod Db. I'm using MS SQL Server
Table Location
LocId StartDt EndDT
1 Jan-23-2015 Dec-31-9999
1 Feb-15-2015 Dec-31-9999
2 Mar-18-2015 Apr-28-2015
2 Nov-23-2015 Dec-31-9999
2 Jul-23-2015 Nov-23-2015
2 Apr-28-2015 Dec-31-9999
This is how the final table should look which is below
Location
LocId StartDt EndDT
1 Jan-23-2015 Feb-15-2015
1 Feb-15-2015 Dec-31-9999
2 Mar-18-2015 Apr-28-2015
2 Apr-28-2015 Jul-23-2015
2 Jul-23-2015 Nov-23-2015
2 Nov-23-2015 Dec-31-9999
How should I write a select query that will get me the results as per the second table using the first one.
What steps should I perform and what would be the update query to correct the data in location table.