Skip to content

Instantly share code, notes, and snippets.

@indiejoseph
Created May 16, 2014 03:06
Show Gist options
  • Save indiejoseph/d71c199c96ea76bc86db to your computer and use it in GitHub Desktop.
Save indiejoseph/d71c199c96ea76bc86db to your computer and use it in GitHub Desktop.
Increment number in MySQL
SELECT
`chars`.`id`,
@n := @n +1 AS `index`
FROM
`characters` AS `chars`,
(SELECT @n := -1) AS `m`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment