On Tue,  3 Jul 2001 09:44, Eric Fegraus wrote:
> Hi Everyone,
>
> Does this make sense:
> select * from table_name where column_1 LIKE "%word1% OR %word2%";
>
> yeilds 1 record but...
>
> select * from table_name where column_1 LIKE "%word2% OR %word1%";
>
> yields 0 records.
>
> I'm scanning a VARCHAR column trying to return records that contain or
> word1 and word2. Same thing occurs when I replace OR with AND.  The
> search words appear appear in the column as:
>  word1 followed by word2.
>
> Am I using the LIKE incorrectly? Does MySQL have to match the first
> LIKE operator before the second?
>
> Much thanks,
>
> Eric

Indeed you are doing it wrong. Try

select * from table_name where column_1 LIKE "%word2%" OR column_1 LIKE 
"%word1%";

-- 
David Robley      Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES      Flinders University, SOUTH AUSTRALIA  

   Honk if you love peace and quiet.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to