LENGTH(filed)
REPLACE(field,',','')
LENGTH(REPLACE(field,',' ,''))
LENGTH(filed) - LENGTH(REPLACE(field, ',' ,''))
SELECT LENGTH(filed) - LENGTH(REPLACE(FIELD, ',' ,'')) AS `LENGTH` FROM `TABLE` LIMIT 1;
如果需要 +1 处理(场景通常是为了“逗号”分隔,获取元素的分隔数量)
SELECT LENGTH(filed) - LENGTH(REPLACE(FIELD, ',' ,'')) + 1 AS `COUNT` FROM `TABLE` LIMIT 1;版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/m0_37611361/article/details/108490409