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 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 the > word "man" or "men" but not "woman" or "women" > > WHERE (title LIKE 'man') OR (title LIKE 'men') > > but that doesn't return anything. I tried > > WHERE (title LIKE '%man%') or (title like '%men%') > > but that returns everything. I tried using the _ > instead of % but the word may or may not be at the end > or beginning of the line. > > Can someone point me in the right direction (or tell > me how to do it) > > Thanks. Sorry for the newbie question. > > Robert > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Finance - Get real-time stock quotes > http://finance.yahoo.com > > --------------------------------------------------------------------- > 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 > > --------------------------------------------------------------------- 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