suppliertype 字段是有逗号的
统计有几个stInjection,几个stMould
把suppliertype换成自己的字段
select sum(a
.value) value, a
.suppliertype
from (
select a
.value,substring_index
(substring_index
(a
.suppliertype
,',',b
.help_topic_id
+1),',',-1) suppliertype
from
(
select count(a
.id
) value, a
.suppliertype
from trd_company a
where a
.pid
is not null
and a
.authtype
= 'utSupplier'
and a
.suppliertype
is not null
group by a
.suppliertype
) a
join
mysql
.help_topic b
on b
.help_topic_id
< (length
(a
.suppliertype
) - length
(replace(a
.suppliertype
,',',''))+1)
order by a
.value
)a
group by a
.suppliertype
转载请注明原文地址: https://lol.8miu.com/read-4571.html