如何统计mysql字段中有多少个分号?

解决方案 »

  1.   

    lz 图画的不错,用啥截图软件啊?学学。下面是计算个数的,对于你截图的例子,你要加个 1 就可以了:
    mysql> select @str, length(@str) - length(replace(@str, ";", "")) as 'num';
    +--------+------+
    | @str   | num  |
    +--------+------+
    | a;b;c;d|    3 |
    +--------+------+
    1 row in set
      

  2.   

    select length(f1)-length(replace(f1,';','')) from tt
      

  3.   

    select @str, length(@str) - length(replace(@str, ";", ""))
      

  4.   

    谢谢各位,画图软件是fastone capture