Forked from carloscarcamo/reorderAutoIncrementIDs.sql
Created
September 3, 2021 12:50
-
-
Save sandasan/03c25892cf4cd0892935d6736e618a1c 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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment