List:General Discussion« Previous MessageNext Message »
From:Pintér Tibor Date:October 24 2008 10:21pm
Subject:Re: How to count # of character occurrences in a string?
View as plain text  
> I have a Char column with text data like "ab:cdef:h" and I'd like to 
> count the number of ":" in the column. I can't find an easy way to do 
> it. I thought there should be a MySQL function to do this. Any suggestions?

select length('aa:bb:cc:dd')-length(replace('aa:bb:cc:dd',':',''));

btw ever heard of google?

t
Thread
How to count # of character occurrences in a string?mos25 Oct
  • Re: How to count # of character occurrences in a string?Pintér Tibor25 Oct
  • Re: How to count # of character occurrences in a string?Jim Lyons25 Oct