Skip to content

Instantly share code, notes, and snippets.

@jpadilla
Created February 18, 2011 20:15
Show Gist options
  • Save jpadilla/834329 to your computer and use it in GitHub Desktop.
Save jpadilla/834329 to your computer and use it in GitHub Desktop.
Re-calculate's primary index id
set @primary_key := 0;
UPDATE `table_name` SET `id` = @primary_key := @primary_key + 1 ORDER BY `id`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment