NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL WHERE clause question

Jeff jsiegel1 at optonline.net
Fri May 9 19:44:29 EDT 2003


I thought about full text but even if the user manages to find all 5000
records (we're not talking millions here) I only display the first 200
matches...kinda forces the user to come up with better search criteria
to narrow their own search.

Jeff

-----Original Message-----
From: Ophir Prusak [mailto:ophir at prusak.com] 
Sent: Friday, May 09, 2003 8:42 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] MySQL WHERE clause question


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