I am having a trouble with using GROUP_CONCAT in MySQL
My tables g0
as follows:
ID Age Sex
-------------
1 16 Male
2 18 Female
3 16 Male
4 18 Female
5 16 Male
But I need the table to look like
ID count
1,3,5 3
2,4 2
I tried this query:
SELECT GROUP_CONCAT(
CONCAT(cnt)) cnts FROM
(SELECT COUNT(ID) as cnt FROM g0 GROUP BY Age , Sex order by ID Desc) ;
But I get this error message:
1248. Every derived table must have it's own alias