How to create a Top 10 based on values from a database?
I have a database table that stores scores for events, like a rating system.
Users choose an event they want to score, enter their score/rating and insert this into the database table.
This gives me, in my table:
Event - Rating - User
Soccer - 5 - Joe Public
Soccer - 4.5 - Jane Public
Tennis - 3 - Joe Public
...and so on.
I would like to do two things. Firstly, I need to calculate the average for each event, which is easy enough, although I haven't quite got my head around the GROUP BY clause which, as I understand it, only allows me to use one database field?
Secondly, I would like to display, dynamically from the database, a list of top 10 events based on the results of the average ratings.
How easy is this to achieve? I'm using ASP/VBScript and MSSQL database.
Appreciate any advice offered. Thanks.
Regards
Nath.
