Last active
August 10, 2022 08:22
-
-
Save carloscarcamo/28441ee9b3a9c7807ce4 to your computer and use it in GitHub Desktop.
Reorder auto increment IDs on MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @count = 0; | |
UPDATE table_name SET table_name.id = @count:= @count + 1; | |
ALTER TABLE table_name AUTO_INCREMENT = 1; |
thx!
Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks