2

I'm writing a MySQL query to get some data out of a table based on how many votes an 'object' has: SELECT * FROM data ORDER BY votes DESC is what I'm using now. However, I want to see where the objects rank, and have a temporary 'ranking' row, so I can grab that integer and use it accordingly.

Thanks.

Edit:

Output:

id | name  | votes
2  | Test  | 8
1  | Test2 | 5

Wanted output:

id | name  | votes | ranking
2  | Test  | 8     | 1
1  | Test2 | 5     | 2
Phil
  • 157,677
  • 23
  • 242
  • 245
  • kindly post input and expected output. Also kindly read How to Ask http://stackoverflow.com/help/how-to-ask – KP. May 16 '16 at 05:01
  • http://stackoverflow.com/questions/3333665/rank-function-in-mysql check this out, this should help you solve the problem – JackRobinson May 16 '16 at 05:18

0 Answers0