NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL WHERE clause question

Ophir Prusak ophir at prusak.com
Fri May 9 09:42:22 EDT 2003


Just a side note,

If you're gonna be searching for a word within a column using LIKE, you
should consider using MySQLs full text engine.
http://www.mysql.com/doc/en/Fulltext_Search.html

If performance is not an issue and you're only doing this once in a while,
then using LIKE shouldn't be to bad.

Regarding your REGEXP, this probably isn't the best solution, but I'd use:
REGEXP "^ford | ford |ford$".

----- Original Message ----- 
From: "Jeff" <jsiegel1 at optonline.net>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Friday, May 09, 2003 9:21 AM
Subject: RE: [nycphp-talk] MySQL WHERE clause question


> What's the difference between "SELECT * FROM `table` WHERE `column`
> REGEXP "[[:blank:]]ford[[:blank:]]"
> and using this - "DE_sDescription LIKE  'ford %' OR DE_sDescription LIKE
> '% ford' OR DE_sDescription LIKE  '% ford %'"
>
> In this case of the former (the REGEXP) it would seem that if "ford" is
> the first word in the text it would not pick it up since there is no
> blank/space before "ford" at the beginning of the text.
>
> Is this correct?
> Or...in terms of speed, would it be better to use the REGEXP expression
> in the same way I'm using the "%" wildcard? (that is...with the
> different variations of blanks).
>
> Jeff
>
>
>
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>
>





More information about the talk mailing list