select id, length(string)-length(replace(string,',','')) cnt from strings
使用length 和 replace函数配合得到逗号个数