At 04:52 PM 12/12/2007, Baron Schwartz wrote:
Hi,

On Dec 12, 2007 5:39 PM, mos <[EMAIL PROTECTED]> wrote:
> I have a Char(50) column and I want to count the number of "." in the
> column using a Select statement. I don't see any MySQL function that can
> count the number of occurrences of a character in a string. Is there a
> simple way to do this?

LENGTH(str) - LENGTH(REPLACE(str, '.', ''))

Baron,

Thanks, I gave it a try and it works. :)

But why can't MySQL create a function to do that otherwise the SQL harder is much harder to read.

Just my 2 cents worth.

Mike
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to