title: MySQL math to get Top 3 scores
body: <p>I'm doing a website for a Fantasy Movie League and what I'm trying to do is get the Top 3 Total Scores overall</p>
  
  <p>Total scores should be: The sum of various points for each players's active movies DIVIDED BY the number of that player's active movies</p>
  
  <p>(So if a player has 300 points from active movies and has 3 active movies, the answer should be 100)</p>
  
  <p>So my question is: How do I calculate the individual player's number of active movies (in the subquery) without specifying the player_id?</p>
  
  <pre><code>SELECT 
  players.id as player_id,
  first_name, last_name,
  (metacritic + (imdb*10) + top_bottom + power(receipts,(2/9)) + ticket + oscar_noms + oscar_wins + gg_noms + gg_wins + isa_noms + isa_wins + razzie_noms + razzie_wins + festival_points + ifca_points) / (SELECT COUNT(id) FROM movies WHERE release_date &gt;= CURDATE() and year_id=1 and player_id=4) as player_active_movie_total
  FROM movies
  INNER JOIN players on players.id=movies.player_id
  WHERE release_date &gt;= CURDATE() and year_id=1
  ORDER BY player_active_movie_total DESC
  LIMIT 3
  </code></pre>