i am having a table tb_user in which the record are as like:
Name gender location grewup date of birth
Arun male india britain 1998-02-03
sonia female USA dubai 1994-02-03
sheetal female india Russia 1993-02-03
what i want is the record in the following manner :
Age Bracket Total Count Female Male
18-25 50 22 28
26-30 30 12 18
31-36 20 10 10
37-42 10 3 7
43-48 5 2 3
i have used the query as :
select COUNT(id) as total count sum(IF(`sex` = 'Female',1,0)) as female,sum(IF(`sex` = 'Male',1,0)) as male as male FROM tb_user_info GROUP BY `date of birth`
but i am not able to get the age bracket like i mentioned