Click here to Skip to main content
15,921,179 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a table with the following data

Record
0
0
2
4
5
6
6
5
4
3

I need a new column [Record_Dup] and the values for the column should be next row value of the [Record]

Output:

VB
Record Record_Dup
0 0
0 2 
2 4
4 5
5 6
6 6
6 5
5 4
4 3
3 NULL


How to acheive the expected result
Posted
Updated 12-Apr-15 22:51pm
v2
Comments
Maciej Los 13-Apr-15 1:36am    
Is there any Primary Key? What database?
Praveen Kumar Upadhyay 13-Apr-15 4:14am    
Please mention your problem. We can try to give you a solution after that.
John C Rayan 13-Apr-15 4:56am    
What version of SQL SERVER are you using?

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900