[nycphp-talk] MySQL WHERE clause question
Jeff
jsiegel1 at optonline.net
Tue May 13 10:00:19 EDT 2003
Thanks for the tip. I'm going to play around with this and see if this
improves the search.
-----Original Message-----
From: max goldberg [mailto:max at idsociety.com]
Sent: Monday, May 12, 2003 12:40 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] MySQL WHERE clause question
From: http://www.mysql.com/doc/en/Regexp.html
[[:<:]]
[[:>:]]
These match the null string at the beginning and end of a word
respectively. A word is defined as a sequence of word characters which
is neither preceded nor followed by word characters. A word character is
an alnum character (as defined by ctype(3)) or an underscore (_).
mysql> SELECT "a word a" REGEXP "[[:<:]]word[[:>:]]"; -> 1
mysql> SELECT "a xword a" REGEXP "[[:<:]]word[[:>:]]"; -> 0
You can do SELECT * WHERE DE_sDescription REGEX "[[:<:]]ford[[:>:]]";
Not sure how the speed would compare, but it may be faster.
-Max
Jeff wrote:
> This question concerns how to format a "WHERE" clause so that it only
> finds those records that have a particular word buried within the
> text. For example, if my WHERE clause has "DE_sDescription LIKE
> "%ford%" it will return records that have the word "affordable" in the
> description field. But if I remove the wild cards, then it doesn't
> find those records that may have the word "ford" buried within a text
> (the text runs 500 characters at the max).
>
> Any pointers would be *greatly* appreciated.
>
> Jeff
>
>
>
>
>
>
>
>
>
--- Unsubscribe at http://nyphp.org/list/ ---
More information about the talk
mailing list