Created
August 22, 2016 13:31
-
-
Save glafarge/17fc33f0ce1ae5765f3a8b7812389558 to your computer and use it in GitHub Desktop.
Reincrement field of a MySQL table
This file contains 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 @pos := 0; | |
UPDATE table SET position = ( SELECT @pos := @pos + 1 ) ORDER BY id ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment