I need to update these NULL values:
PK | CODE ---+------- 1 | 20 2 | NULL 3 | NULL 4 | 30 5 | NULL 6 | NULL 7 | NULL 8 | 40 9 | NULL
Like this:
PK | CODE -----+------------ 1 | 20 2 | 20 3 | 20 4 | 30 5 | 30 6 | 30 7 | 30 8 | 40 9 | 40
It should always be based on the last minimum value.
I tried the code below, but it just updates the first line before whoever had the value at the beginning.
QUERY
UPDATE TT SET CODE = (SELECT CODE FROM
source share