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