select guid, first_name, created_at,
case when truncate(datediff(curdate(), birth_date)/365, 0) >= '0' and truncate(datediff(curdate(), birth_date)/365, 0) <=17 then 'under 18'
when truncate(datediff(curdate(), birth_date)/365, 0) > '18' and truncate(datediff(curdate(), birth_date)/365, 0) <=24 then '18-24'
when truncate(datediff(curdate(), birth_date)/365, 0) > '24' and truncate(datediff(curdate(), birth_date)/365, 0) <=34 then '25-34'
when truncate(datediff(curdate(), birth_date)/365, 0) > '34' and truncate(datediff(curdate(), birth_date)/365, 0) <=44 then '35-44'
when truncate(datediff(curdate(), birth_date)/365, 0) > '44' and truncate(datediff(curdate(), birth_date)/365, 0) <=54 then '45-54'
when truncate(datediff(curdate(), birth_date)/365, 0) > '54' and truncate(datediff(curdate(), birth_date)/365, 0) <=64 then '55-64'
when truncate(datediff(curdate(), birth_date)/365, 0) > '64' and truncate(datediff(curdate(), birth_date)/365, 0) <=110 then '65+'
end as age_group
from users
where contains (created_at, '"2016" OR "2017"')
group by guid