sql中截取某个字段获取特定的值

根据,将deptuser_name字段进行切割获取最后一个索引的值
 SELECT REVERSE(left(REVERSE(deptuser_name),LOCATE(',',REVERSE(deptuser_name))-1)) deptName ,count(deptuser_id) countSum from table group by  deptuser_id 

版权声明:本文为qq_39994174原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。