SQL统计一个字段里某个特定字符的个数

select sum(length(couponrecordid)-length(replace(couponrecordid,',',''))) from t_order where paytype=2 and (studentstate!=4 and coachstate!=4)

and couponrecordid  like '%,%';


其中:couponrecordid 字段中的值:

12,566

67,45,88,99

134,7,8,9,678   



原文地址:https://www.cnblogs.com/luleiitlife/p/8545072.html