I am trying to use window functions to carry forward the last null value. I have been able to do this using postgres by including an ‘ignore nulls’ clause as part of the window function. Is there a way to do the equivalent using memsql?
This should work for you:
select *, first_value(somevalue) over w as carryforward_somevalue
from (
select *, count(somevalue) over (partition by person order by id ) as value_partition
from test1
) as q
window w as (partition by person, value_partition order by id);
Note, I got this solution from this stackoverflow post: mysql - Last observation carried forward / ignore nulls in lag - Stack Overflow
1 Like