Reputation: 1
Given a table like this with single column,
Names
------
A
B
C
D
E
Take each record from table and check previous and next value and put it across new table. Print 'null' if no previous or next value exists with column name as prev_name,current_name,next
Prev_name| Current name| next
-----------------------------
NULL | A |B
A | B |C
B | C |D
C | D |E
D | E |NULL
I am learning SQL and googled to find something which might help solve this but couldn't.
Any help will be great!
Upvotes: 0
Views: 39