2个回答
展开全部
只统计行数:
select count(1) from table where msg_content like '【海尔】%'
要统计包含【海尔】的 msg_total ?
select sum(MSG_TOTAL) from 表 where MSG_CONTENT LIKE '【海尔】%'
追问
【海尔】这个是不固定的算了我自己想到怎么写了
SELECT substring(
MSG_CONTENT,
locate( "【", MSG_CONTENT )+1,
locate( "】", MSG_CONTENT )-locate( "【", MSG_CONTENT )-1
) AS QM ,SUM(MSG_TOTAL)
FROM txtt
GROUP BY QM
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询