title: How to use aliases in math operators in SQL?
body: <p>First of all, please correct me if "alias" is the wrong word. I am talkin about renaming the column with <code>AS</code> operator.</p>
  
  <p>So I'm trying calculate an average like this :</p>
  
  <pre><code>SELECT
  users.username AS player_name,
  COUNT(*) AS total_games,
  SUM(games.points) AS total_points,
  (total_points / total_games) AS average_points
  
  FROM games,
  INNER JOIN users
  ON games.player_id = users.id
  GROUP BY games.player_id
  </code></pre>
  
  <p><em>(the query might be wrong, its just a quick example)</em></p>
  
  <p>in this query, the line </p>
  
  <pre><code>(total_points / total_games) AS average_points
  </code></pre>
  
  <p>gives an error : <code>unknown column total_points</code></p>
  
  <p>so how can I fix this to keep using the aliases, instead of writing this :</p>
  
  <pre><code>(SUM(games.points) / COUNT(*) ) AS average_points
  </code></pre>
  
  <p>Thanks for any help !</p>