In order to do this, you'll need some sort of identifier for the previous row. Hypothetically (since I am waiting for clarification on 'previous' in your example), let's say you have a primary key identifier for each row:
| id | col1 | col2 |
+----+------+------+
| 1 | 0.1 | 0.2 |
| 2 | 0.23 | 0.53 |
| 3 | null | 0.46 |
| 4 | 0.77 | null |
| 5 | null | 0.32 |
You can use the value from the previous primary key to update the table. You can JOIN
the two tables on the condition that the id matches the previous one, and set the col1 value accordingly like this:
UPDATE myTable m
JOIN myTable mt ON (m.id - 1) = mt.id
SET m.col1 = mt.col1 WHERE m.col1 IS NULL;
To do this for both columns in the same update query, you'll need to add an IF
statement:
UPDATE myTable m
JOIN myTable mt ON (m.id - 1) = mt.id
SET m.col1 =
CASE WHEN m.col1 IS NULL THEN
mt.col1
ELSE
m.col1
END,
m.col2 =
CASE WHEN m.col2 IS NULL THEN
mt.col2
ELSE
m.col2
END;
Here is another reference on the conditional update, and an SQL Fiddle example. Currently I can't run the query, just the build schema option. I will edit this answer with the results when I can.
Note that this will not work if there are two null values in a row. If that is possible, you will need to join the rows on the most recent non-null id.