Skip to content

Instantly share code, notes, and snippets.

@jvorcak
Created September 18, 2015 07:56
Show Gist options
  • Save jvorcak/0dfff10a2f95e1bf2a0f to your computer and use it in GitHub Desktop.
Save jvorcak/0dfff10a2f95e1bf2a0f to your computer and use it in GitHub Desktop.
Mysql: update a value with incrementing number
mysql> select @i := 0;
mysql> update bar set c = (select @i := @i + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment