title: Calculate total score in SQL query from multiple tables
body: <p>I have the following tables for a competition:</p>
  
  <h2>User:</h2>
  
  <ul>
  <li>Id</li>
  <li>Name</li>
  <li>Email</li>
  <li>EntryId</li>
  </ul>
  
  <h2>Entry:</h2>
  
  <ul>
  <li>Id</li>
  <li>Age</li>
  <li>Gender</li>
  <li>State</li>
  </ul>
  
  <h2>GameResult:</h2>
  
  <ul>
  <li>Id</li>
  <li>EntryId</li>
  <li>Duration</li>
  <li>Score</li>
  </ul>
  
  <h2>QuestionResult:</h2>
  
  <ul>
  <li>Id</li>
  <li>EntryId</li>
  <li>Correct</li>
  <li>UsersAnswer</li>
  </ul>
  
  <p>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.</p>
  
  <p>The calculations are as follows:</p>
  
  <p>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.</p>
  
  <p>So, for an entry, the total score will be:</p>
  
  <p>(Count(Qn.Correct) * QuestionScore) + SUM(G1.Score, G2.Score, Gn.Score)</p>
  
  <p>Not sure where to start in figuring this query out.</p>