SQL LAG
-- Employee --
------------------------
| 1 | Max | 01.02.2018 |
| 2 | Jon | 15.04.2018 |
| 3 | Eve | 28.06.2018 |
------------------------
SELECT *,
Lag(DateColumn, 1) OVER(.ORDER BY DateColumn ASC) AS EndDate
FROM @Employee;
-- Add new column and shift line + 1 of DateColumn
-------------------------------------
| 1 | Mae | 01.02.2018 | NULL |
| 2 | Jon | 15.04.2018 | 01.02.2018 |
| 3 | Eve | 28.06.2018 | 15.04.2018 |
-------------------------------------
-- See the source for better explanation
Swiss IT knive