title: How to get a percentage of total when the query has a GROUP BY?
body: <p>Say I have a non-normalized table with movie actor names and the movies they've been in. eg.</p>
  
  <pre><code>CREATE TABLE movies_actors (
    movies_actors_id INT,
    movie VARCHAR(255),
    actor VARCHAR(255),
    PRIMARY KEY (movies_actors_id)
  );
  </code></pre>
  
  <p>I do a <code>SELECT actor, COUNT(1) FROM movies_actors GROUP BY actor</code> to find out how many movies the actor has been in. But I also want to find out what percentage of movies that actor has been in.</p>
  
  <p>I guess I could do this:</p>
  
  <pre><code>SELECT
    actor,
    COUNT(1) AS total,
    COUNT(1) / (SELECT COUNT(1) FROM movies_actors) * 100 AS avg
  FROM movies_actors
  GROUP BY actor;
  </code></pre>
  
  <p>But that just seems...  idk...  yucky.</p>
  
  <p>Any ideas?</p>