user_add_age AS( SELECT user_id, gender, birth, substr(date(), 1, 4) - birth AS age, CASE WHEN substr(date(), 1, 4) - birth >= 80 THEN '80' WHEN substr(date(), 1, 4) - birth >= 70 THEN '70' WHEN substr(date(), 1, 4) - birth >= 60 THEN '60' WHEN substr(date(), 1, 4) - birth >= 50 THEN '50' WHEN substr(date(), 1, 4) - birth >= 40 THEN '40' WHEN substr(date(), 1, 4) - birth >= 30 THEN '30' WHEN substr(date(), 1, 4) - birth >= 20 THEN '20' WHEN substr(date(), 1, 4) - birth < 20 THEN '10' ELSE 'ͦͷଞ' END AS age_range FROM users WHERE is_deleted = 0 ) SELECT age_range, COUNT(DISTINCT user_id) as uu FROM user_add_age GROUP BY age_range ORDER BY age_range w BHF@SBOHF Ͱ(3061#:ͯ͠ਓΛΧϯτ w ਓͷΧϯτVTFS@JEΛϢχʔΫʹͯ͠Χϯτ ͢Δ w ඞཁʹԠͯ͡03%&3#:Ͱॱʹฒସ͑