NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL WHERE clause question

Ed McCarroll Ed at ComSimplicity.com
Fri May 9 00:12:40 EDT 2003


> "Select * Where Description Like 'ford %' or like '% ford' or
> like '% ford %'"

This won't find "Buy a ford."

I'm not an SQL expert, but I'm constantly dealing with similar issues
in a "search and replace" context.

Could you first pass the Description through a regexp that translates
all punctuation into spaces?  It could also put a space before and
after the Description, so that you could skip the "Like 'ford %'"
and "Like '% ford'" parts.

Regards,

  Ed

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ed McCarroll                          MailTo:Ed at ComSimplicity.com
ComSimplicity                                      (310) 838-4330
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 




More information about the talk mailing list