select length('10,A,B')-length(replace('10,A,B',',','')) as cnt;

select length('10,A,B'); -- 得出整体字符串长度

select replace('10,A,B',',',''); -- 以‘’来替换逗号,注意单引号中间没有空格,直接‘’左右单引号即可;

-- 两者相减

select length('10,A,B')-length(replace('10,A,B',',','')) as cnt;