My table has 500 rows of users, but their ids are something like these now: "7454,21201, 31317..."
I would like to rearrange the ID orders to "1,2,3,4,5....".
What can I do? thanks
It is a column named id
in users
table
Try this query. Hope it's help to find your solution
SET @count = 0;
UPDATE `users` SET `users`.`id` = @count:= @count + 1;
ALTER TABLE users AUTO_INCREMENT = 1;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.