select
tstamp,
if(val1 is null,@prevVal1,@prevVal1:=val1),
if(val2 is null,@prevVal2,@prevVal2:=val2)
from t;
O operador :=atribui um valor a uma variável e também retorna esse valor.
select
tstamp,
if(val1 is null,@prevVal1,@prevVal1:=val1),
if(val2 is null,@prevVal2,@prevVal2:=val2)
from t;