All Forums Analytics
ssinha 1 post Joined 07/16
06 Jul 2016
Replacing missing value with next vaules

I have a data like
Attmpt_dt
1/1/2016
?
?
?
?
1/10/2016
?
?
?
1/31/2016
 
 
I want it to covert 
 
 
Attmpt_dt
1/1/2016
1/10/2016
1/10/2016
1/10/2016
1/10/2016
1/10/2016
1/31/2016
1/31/2016
1/31/2016
1/31/2016

 
So, I am replaceing every missing value with the next known date. How to do it in teradata. Thank you in advance for help.

dnoeth 4628 posts Joined 11/04
07 Jul 2016

Assuming that the rows are sorted by date it's a simple MAX(Attmpt_dt) OVER (ORDER BY sortcolumn).
 
Otherwise you need LAST_VALUE (Attmpt_dt IGNORE NULLS) OVER (ORDER BY sortcolumn)

Dieter

You must sign in to leave a comment.