Update grouped records in Oracle with an incremental value
UPDATE table_t t1
SET FIELD_NEW = (SELECT rnk
FROM (SELECT id_val,
row_number() over (partition by GROUPING_COULUMN
order by id_val) rnk
FROM table_t ) t2
WHERE t2.id_val = t1.id_val)
No comments:
Post a Comment