title: Nested MySQL syntax error trying to add division operator
body: <p>I have a query that looks like this that executes and works perfectly:</p>
  
  <pre><code>UPDATE users
  SET player_skill = (
  (
          SELECT
              sum(avg_score)
          FROM
              skill
          WHERE
              username = "JohnDoe"
          AND game = "Bingo"
      ) - 
      (
          SELECT
              sum(avg_score)
          FROM
              events
          WHERE
              game = "Bingo"
      ) 
  
  ) WHERE username = "JohnDoe"
  </code></pre>
  
  <p>I want to add a division operator like this:</p>
  
  <pre><code>UPDATE users
  SET player_skill = (
      (
          (
              SELECT
                  sum(avg_score)
              FROM
                  skill
              WHERE
                  username = "JohnDoe"
              AND game = "Bingo"
          ) - (
              SELECT
                  sum(avg_score)
              FROM
                  events
              WHERE
                  game = "Bingo"
          )
      ) / SELECT
          COUNT(*)
      FROM
          skill
      WHERE
          username = "JohnDoe"
      AND game = "Bingo"
  )
  WHERE
      username = "JohnDoe"
  </code></pre>
  
  <p>It spits out an error code at me</p>
  
  <pre><code>[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COUNT(*)
  FROM
      skill
  WHERE
      username = "JohnDoe"
  AND game = "Bingo" )
  ) W' at line 21
  </code></pre>
  
  <p>I've tried for awhile but can't seem to figure out why it wont let it run. I have similar queries to this that seem fine but I cannot get this one to work.</p>
  
  <p>Any help would be greatly appreciated.</p>