Skip to content
Advertisement

Teradata SQL getting last not null value

I have a table in Teradata that looks like this:

I need to fill the column Install_Pay_Dt with the first not null value. For example, it should look like this:

I’m using Teradata 15 so I can’t use lag. I’ve been searching a lot but I can’t find a solution. The ID column is Account_Num and the order column is Install_num.

I’ve tried to do something like this:

But it only fills the second row.

Advertisement

Answer

last_value is quite similar to lag, both support the IGNORE NULLS option

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement