Hi!

I am struggling with trying to count how many string patterns of a given
kind occur in any given row of a mysql table.

My table looks like this:

Pattern varchar(200)
HowMany varchar(3)

The patterns that appear in the Pattern field can be aphabetic chars only,
but spaces can appear at the beginning or ends of lines, and anywhere in
between.  Sometimes spaces seperate sequences, but not always.  I can't look
for 3 "W"s together because sometimes a sequence is 3 of them, but sometimes
it is 23 of them of 5 of them, etc.  Any given sequence will never exceed
200 chars, and each char actually represents a month that the person was in
a program.  A line is an individual's program history.  .

Here is an example:

WWWWW WWHHHH WW HHHWWWHH  <= this is 7 different sequences

So WWHHHH is two sequences, as is WW HHHH

I'd like to use a select statement to count the number of  sequences of
chars that occur on each and every line in the table, (and store that number
to a variable).   It is like looking for words, except that the sequences
are not always separated by spaces.

I can easily use REGEXP to count the rows in which a particular pattern
occurs, but I can't seem to figure out how to count the number of sequences
in each and every row.

Can anyone help?

Thanks heaps!!

-Warren





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

Reply via email to