I have a DB-Table with:
ID belongsTo sort
100 null null
221 100 null
345 100 null
432 100 null
587 100 null
627 100 null
787 100 null
I want to fill the sort-column with values 100, 200, 300,... for the lines with belongsTo=100 in ascending order of ID. Is this possible with one update statement? Is there a possibility to apply an ORDER BY to the update and use ROWNUM?
So I want the following result in this case:
ID belongsTo sort
100 null null
221 100 100
345 100 200
432 100 300
587 100 400
627 100 500
787 100 600