mysql截取字符统计数量

SELECT substring_index(substring_index(a.AuditOpinionCodes, ',', b.help_topic_id + 1), ',', - 1) AS opinionCode,count(1) as total
FROM smokeaudit a
INNER JOIN mysql.help_topic b ON b.help_topic_id < (length(a.AuditOpinionCodes) - length(REPLACE(a.AuditOpinionCodes, ',', '')) + 1)
where a.AuditTime >='2021-02-01 00:00:00' and OperatingType=0 and OperatingValid=1 GROUP BY s.RSStationCode,opinionCode

posted @ 2021-02-23 09:31  不再犯错  阅读(544)  评论(0编辑  收藏  举报