Hi,
Please help me to acheive this requirement.
Input:
| id | Value |
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
| 4 | 400 |
| 5 | 500 |
Output:
| id | Value | Pre | Nxt |
| 1 | 100 | 0 | 200 |
| 2 | 200 | 100 | 300 |
| 3 | 300 | 200 | 400 |
| 4 | 400 | 300 | 500 |
| 5 | 500 | 400 | 0 |
| id | Value |
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
| 4 | 400 |
| 5 | 500 |
| id | Value | Pre | Nxt |
| 1 | 100 | 0 | 200 |
| 2 | 200 | 100 | 300 |
| 3 | 300 | 200 | 400 |
| 4 | 400 | 300 | 500 |
| 5 | 500 | 400 | 0 |
Know the answer? Post it. Somebody with the same question will find it here.

Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jenith ThakkarRank #789 · 2.9K reputationPosted Jul 24, 2018, 10:17 PM EDT