Hi -
I am having trouble with a query. Can someone assist please?
Heres the basics:
I need to pull several data items from the DB:
Under table 'games' - the field: 'highscorerid'
The value of the highscorerid is the users ID (IE: user # would be 1 for user #1 and 75 for user # 75 ... etc).
On this table, it houses much information and many fields. Game Name, Game Description ... etc. It is a table for an arcade.
Next, we have a different table: 'user' (It houses the database information) - and 1 of those fields is 'username' (note, that the field 'userid' is also located here ... this is the same value as the field highscorerid located above)
Each game has a highscorerid. 1 user can have umpteen highscores. There are 500 games, so there are 500 lines in this table to go through.
What I want to do, is:
Check the data to find the "top 5 users with most highscores"
and associate the user id with the user name, with the output being something like this:
"The top 5 users with the most highscores are:
1st Place : USERID#x: UsersnameX has xx Highscores
2nd Place : USERID#x: UsersnameX has xx Highscores
3rd Place : USERID#x: UsersnameX has xx Highscores
4th Place : USERID#x: UsersnameX has xx Highscores
5th Place : USERID#x: UsersnameX has xx Highscores"
I can make the output via the template, but am lost asto what query should be run (with as little queries as possible) in order to get the data that I need.
Can anyone help me with this? MANY Thanks for any assistance!!