I store data for lap times in a database, the data consists of distance, time, average speed and maximum speed.
I'm trying to display a leaderboard that shows the top ten people in any query that you asked (who is the most in general, the best average term, etc.). However, below the top ten I want to show the user by registering a position in the leaderboard. To do this, I try to run the same query, ordering my results, and adding ROW NUMBER to get the position.
I use symfony 1.4 with Doctrine ORM, and I can’t understand for life how to get line numbers in a query. I know that you can do this in SQL like this:
SELECT full_name, ROW_NUMBER() OVER(ORDER BY distance) AS row_number
But I cannot get it to work in Doctrine Symfony.
Does anyone have any ideas how I can do this? (or even another way around this)
Thanks in advance.
source
share