I have a table videos
with the columns id
| position
| title
now I want to sort the column position
from the end to the bottom in a permanent way with e.g. UPDATE
. I could change that manually but there are more than 460 rows I would have to update manually which is really annoying.
I already tried
SELECT position FROM videos ORDER BY position + 0 asc;
which shows the needed result but I don't know how to make it a permanent change. If I use
UPDATE videos SET position = (SELECT position FROM videos ORDER BY position + 0 asc);
which changes the rows of the column to one value.
The table looks like this
Id | position | title
---------------------------
tz7e | 3 | title1
-cQ6 | 4 | title2
Q1L3 | 1 | title3
y456 | 2 | title4
V2n4 | 5 | title5
p76b | 7 | title6
98kN | 6 | title7
But it want to have it like that
Id | position | title
---------------------------
tz7e | 7 | title1
-cQ6 | 6 | title2
Q1L3 | 5 | title3
y456 | 4 | title4
V2n4 | 3 | title5
p76b | 2 | title6
98kN | 1 | title7
But with 460 entries in the column position
that I want to rerow.