正确题解:

select
substring_index(substring_index(profile,',',3),',',-1) as age, #重点
count(device_id) as number
from user_submit
group by age

⚠️Stella的两个迷糊点:

  1. 因为age在中间所以要截取两遍,才可以截取到
  2. 直接使用substring_index()时提取,不需要自己用case再分类