id field
1 100
2 80
3 200
4 230
Is it possible to find out the rank of id 2 for example if ordered by field DESC?
In this case the ranks would be:
1. #4
2. #3
3. #1
4. #2 (our winner)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I understand your question correctly, this is what you would need. Note that since MySQL doesn’t have a row numbering function, you need to use a variable in its place