A quick and dirty way would be to use an expression like length(x) - length(replace(x, ":", ""))
Here's some code that I actually ran: set @x = "aa:bb:cc:dd"; set @colons = length(@x) - length(replace(@x, ":", "")); select @x , @colons; On Fri, Oct 24, 2008 at 5:16 PM, mos <[EMAIL PROTECTED]> wrote: > 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? > > TIA > Mike > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com