题解 | #截取出年龄# 截取两遍是关键
截取出年龄
https://www.nowcoder.com/practice/b8d8a87fe1fc415c96f355dc62bdd12f
正确题解:
select substring_index(substring_index(profile,',',3),',',-1) as age, #重点 count(device_id) as number from user_submit group by age
⚠️Stella的两个迷糊点:
- 因为age在中间所以要截取两遍,才可以截取到
- 直接使用substring_index()时提取,不需要自己用case再分类