SELECT id,length(string)-length(replace(string,',','')) cnt
FROM strings