title: mysql count items in group_concat
body: <p>I am having a trouble with using GROUP_CONCAT in MySQL
  My tables <code>g0</code> as follows:</p>
  
  <pre><code>ID  Age Sex
  -------------
  1   16  Male
  2   18  Female
  3   16  Male
  4   18  Female
  5   16  Male
  </code></pre>
  
  <p>But I need the table to look like</p>
  
  <pre><code>ID        count
  1,3,5       3
  2,4         2
  </code></pre>
  
  <p>I tried this query:</p>
  
  <pre class="lang-sql prettyprint-override"><code>SELECT GROUP_CONCAT(
  CONCAT(cnt)) cnts FROM 
  (SELECT COUNT(ID) as cnt FROM g0  GROUP BY Age , Sex order by ID Desc) ;
  </code></pre>
  
  <p>But I get this error message: </p>
  
  <pre><code>1248. Every derived table must have it's own alias
  </code></pre>