I want to update sequence field in characteristic_data.
SELECT ID characteristic_ID, name, sequence, figure, ROW_NUMBER() OVER (ORDER BY name) as sequence_new_value FROM characteristic_data WHERE characteristic_ID = 4 ORDER BY name;
works.
Now I want to update sequence with sequence_new_value.
UPDATE characteristic_data SET sequence = ROW_NUMBER() OVER (name) WHERE characteristic_ID = 4 ORDER BY name;
Error Code: 4015. Window function is allowed only in SELECT list and ORDER BY clause
Can we use update and row_number() in the same time? Any idea how to do?
I expect sequence field to be updated with incremantal number over name alphabetic order.
Edouard Druenne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.