sql统计name的数量

表机构,统计name的数量

sql语句   mysql.help_topic    id自增的临时表

select (substring_index(substring_index(a.name,';',b.help_topic_id+1),';',-1)) 'name',COUNT('abc') 'count'

from  test_group a

join mysql.help_topic b on b.help_topic_id < (length(a.name) - length(replace(a.name,';',''))+1)

group by `name`

结果:

参考:https://blog.csdn.net/xcymorningsun/article/details/73436568

猜你喜欢

转载自www.cnblogs.com/my0901/p/9298769.html
今日推荐