title: In a MySql query how to return the names of the people who are reported to
body: <p>I had this question during a test of a company, in MySql:
  How to return the names of the people who are reported to (excluding nulls) the number of members that report to them and the average age of those members as an integer. The rows should be ordered by the names in alphabetical order.</p>
  <p>The table:
  ID, FirstName, LastName, ReportsTo, Position, Age</p>
  <p>When I put COUNT(ReportsTo) the results shrink</p>
  <p>I had this query:</p>
  <pre><code>SELECT ReportsTo, Age
  FROM maintable_A9x
  WHERE
  ReportsTo IS NOT NULL
  ORDER BY ReportsTo DESC
  </code></pre>
  <p>The solution comes with an INNER JOIN?</p>
  <p>I tried:</p>
  <pre><code>SELECT ReportsTo, COUNT(ReportsTo), Age
  FROM maintable_A9x
  WHERE
  ReportsTo IS NOT NULL
  GROUPBY ReportsTo
  ORDER BY ReportsTo DESC
  </code></pre>
  <p>But still, with COUNT(ReportsTo) the results shrink and only one line of results come</p>