Re: Help with WHERE string searching

2002-09-07 Thread Steve Edberg
I'd try using MySQL's regular expression functions: Select where title regexp '[[:<:]]m[ae]n[[:>:]]' or if you are generating this query programmatically, it might be simpler to do something like Select where title regexp '[[:<

Re: Help with WHERE string searching

2002-09-06 Thread David Lloyd
H, > >>> Suppose I have a field named title that contains > >> one > >>> of these > >>> I am a Man > >>> I am a Woman > >>> We are Men > >>> We are Women Why not split this into two fields: pronoun enum('I','WE') gender enum('MAN','WOMAN') OR a SET title SET("I","WE","MAN","MEN","WOMAN",

Re: Help with WHERE string searching

2002-09-06 Thread Jed Verity
I see. What about something like this, then: Where title=VAR or left(title,length(VAR)+1)=concat(VAR," ") or right(title,length(VAR)+1)=concat(" ",VAR) or title like "% VAR %" Does that one work? Jed On the threshold of genius, Rob Gambit wrote: >> WHERE ((title like '%man%') or (title like '%

Re: Help with WHERE string searching

2002-09-06 Thread Rob Gambit
> Hi Rob. Give this a shot. > > SELECT * FROM YourTable WHERE title LIKE '% Man' Or > title LIKE '% Men' > > J. Ptak That comes very close to working for everything. Only thing is the word can be at the beginning of the title, the middle of the title, or the end. WHERE (title LIKE '% man') or

Re: Help with WHERE string searching

2002-09-06 Thread Jed Verity
Hi, Rob, Easily resolved. Use 'not like' in conjunction with 'like': WHERE ((title like '%man%') or (title like '%men%')) and title not like '%woman%' and title not like '%women%' Does that work? HTH! Jed On the threshold of genius, Rob Gambit wrote: > Hello MySQL mailing list. > > I am havi

Help with WHERE string searching

2002-09-06 Thread Rob Gambit
Hello MySQL mailing list. I am having trouble creating a SQL statement for searching. Suppose I have a field named title that contains one of these I am a Man I am a Woman We are Men We are Women Now I am trying to search that field using keywords, for example, I want to return any that contain