Created
June 19, 2020 03:51
-
-
Save weird-coon/fc9944791930f5cd9fa17213fe4bd405 to your computer and use it in GitHub Desktop.
Generate auto increment field in select query
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
SELECT @n := @n + 1 n, | |
first_name, | |
last_name | |
FROM table1, (SELECT @n := 0) m | |
ORDER BY user_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment