Created
July 18, 2012 19:48
-
-
Save matthisamoto/3138415 to your computer and use it in GitHub Desktop.
get rank of item in table MySQL
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 @rownum := 0; | |
SELECT rank FROM (SELECT @rownum := @rownum + 1 AS rank, id, complete FROM users WHERE complete=1 ORDER BY created_at) as result WHERE id=27; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment