利用replace、length的内置函数
SELECT id, length(field) - length(replace(field,',',''))+1 as count FROM `table` where 1