I have the following tables for a competition:
User:
- Id
- Name
- EntryId
Entry:
- Id
- Age
- Gender
- State
GameResult:
- Id
- EntryId
- Duration
- Score
QuestionResult:
- Id
- EntryId
- Correct
- UsersAnswer
Each entry will have multiple games, and multiple questions. I need to perform a query that will find a list of the highest scores, and then also break down highest score by demographic, i.e. Age, Gender, State.
The calculations are as follows:
Each correct question will have a score value assigned, e.g. 10 points for each correct answer. Each game will have the score already defined in its column.
So, for an entry, the total score will be:
(Count(Qn.Correct) * QuestionScore) + SUM(G1.Score, G2.Score, Gn.Score)
Not sure where to start in figuring this query out.