只统计行数:
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