I have a SQL table as such
id | date | value |
---|---|---|
1 | 01/01/2019 | 50 |
1 | 04/01/2019 | 25 |
2 | 01/01/2019 | 63 |
2 | 15/01/2019 | 43 |
I want to create another column called next_date, and next_value that computes the next date and value grouped by id in the list, so that the new table will look:
id | date | value | next_date | next_value |
---|---|---|---|---|
1 | 01/01/2019 | 50 | 04/01/2019 | 25 |
1 | 04/01/2019 | 25 | None | None |
2 | 01/01/2019 | 63 | 15/01/2019 | 43 |
2 | 15/01/2019 | 43 | None | None |