select #substring_index(profile,',',-2) as age, count(device_id) as number - 27 male #那就再sub一次,嵌套思想. substr是“之前的”,注意正负交替运用即可取出中间的 substring_index(substring_index(profile,',',-2),',',1) as age, count(device_id) as number from user_submit group by age