LAG Function Impala

96 Views Asked by At

I have a table that looks like this.

exchange_rate_date  from_currency   to_currency
12/18/23            CAD             USD
12/17/23            NULL            NULL
12/16/23            NULL            NULL
12/15/23            CAD             USD

TEST DATA

I need to fill the NULL using the values below for From_Currency and for column To_Currency. I've tried using LAG function

LAG(a.from_currency,1) OVER(PARTITION BY a.from_currency,a.to_currency ORDER BY a.from_currency DESC)

and I'm still getting NULLS. What am I doing wrong here?

0

There are 0 best solutions below