From: Dan Nelson Date: January 21 2004 8:48pm Subject: Re: char count List-Archive: http://lists.mysql.com/mysql/158120 Message-Id: <20040121204817.GB83679@dan.emsphone.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In the last episode (Jan 21), Steve Edberg said: > At 12:17 PM -0600 1/21/04, Joseph S Brunzelle wrote: > > I'm try to write a query that will return the number of times a > > specified character appears in a string (I want known how many > > times the character "M" appears), but I cannot seem to figure out > > how to do that. > > To use the counts on a regular basis, it's probably easier to count > them when you insert or update the record, and store those values in > a separate column. That's what I ended up doing on a few genetics > databases I was working on, anyway - You could also write a UDF to do it, which will be faster than the replace() idea, but requires you to write C. -- Dan Nelson dnelson@stripped