List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 19 1999 2:57pm
Subject:Help with LIKE statement.
View as plain text  
>>>>> "LBFan9911" == LBFan9911  <LBFan9911@stripped> writes:

LBFan9911> I need to find all keyword matches in one field.  I've been using the 
LBFan9911> statement

LBFan9911> where field LIKE "%keyword%" 

LBFan9911> And this works well but if the field contains "warrior" and I'm looking for
> 
LBFan9911> "war" - the record shows up with "warrior".  I tried using the LIKE without
> 
LBFan9911> the % wildcard and it doesn't find anything that it should.  So how do I 
LBFan9911> modify the LIKE statement so it finds only whole word matches.  

LBFan9911> Including words at the beginning of the field.  I mention this because I 
LBFan9911> tried to search for words bracketed by the space character but it would not
> 
LBFan9911> find matches when the word was at the beginning of the field.

LBFan9911> Thanks immensely for your help in advance.

LBFan9911> Jaymes H. Sorbel

Hi!

You can't do this with 'LIKE'.  Use REGEXP instead!

WHERE field REGEXP "[[:<:]]war[[:>:]]"

Regards,
Monty

Thread
Help with LIKE statement.LBFan991118 Sep
  • Re: Help with LIKE statement.James Manning18 Sep
    • Re: Help with LIKE statement.Martin Ramsch19 Sep
      • Re: Help with LIKE statement.James Manning19 Sep
        • Re: Help with LIKE statement.Martin Ramsch19 Sep
      • Re: Help with LIKE statement.Danny Carroll19 Sep
  • Help with LIKE statement.Michael Widenius19 Sep
    • Re: Help with LIKE statement.James Manning20 Sep
      • Re: Help with LIKE statement.Matthias Urlichs26 Sep
        • Re: Help with LIKE statement.Michael Widenius26 Sep
Re: Help with LIKE statement.James Manning19 Sep