I\'ve read some posts about this but none cover this issue.
I guess its not possible, but I\'ll ask anyway.
I have a table with more than 50.000 registers. I
You might wanna clean up gaps in a priority column. The way below will give an auto increment field for the priority. The extra left join on the same tabel will make sure it is added in the same order as (in this case) the priority
SET @a:=0;
REPLACE INTO footable
(id,priority)
(
SELECT tbl2.id, @a
FROM footable as tbl
LEFT JOIN footable as tbl2 ON tbl2.id = tbl.id
WHERE (select @a:=@a+1)
ORDER BY tbl.priority
)