请问我该如何对不同字段,同一内容的值进行count统计
变成如下这种样子
create table test_20220628(a varchar(200),b varchar(200),c varchar(200),d varchar(200));
insert into test_20220628 values ('五险一金','五险一金','下午茶','五险一金');
insert into test_20220628 values ('年终奖金','五险一金','下午茶','五险一金');
create table test_20220628_2(name varchar(200));
insert into test_20220628_2 values ('五险一金');
insert into test_20220628_2 values ('下午茶');
insert into test_20220628_2 values ('年终奖金');
SELECT k.name,
( LENGTH( xx) - LENGTH(REPLACE( xx,k.name,'' )))/length(k.name) AS num
FROM (select group_concat(concat(a,',',b,',',c,',',d)) xx from test_20220628) x,test_20220628_2 k