Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have
Dt Dt_Mnt
1-jan 1-jan
2-feb NULL
3-march NULL
4-April 4-April
5-May NULL

I require below output :

Dt Dt_Mnt
1-jan 1-jan
2-feb 1-jan
3-march 1-jan
4-April 4-April
5-May 4-April

What I have tried:

As i'm new to the sql . Please advise . ( Other than LEAD , LAG)
Posted
Updated 7-May-18 3:29am
v2
Comments
MadMyche 7-May-18 10:59am    
What is the code you are using

1 solution

Put your data in a temp table and add running number using ROW_NUMBER[^] function...
In case value is NULL run a inner-query to select value from previous row, based on the ROW_NUMBER value...
 
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