mysql中查看一个字段中,有几个逗号 利用replace、length的内置函数
SELECT dept_name,ancestors,LENGTH(ancestors)-LENGTH(replace(ancestors,',',''))+1 as count FROM sys_dept