NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL WHERE clause question

Bhulipongsanon, Pinyo Pinyo.Bhulipongsanon at usa.xerox.com
Fri May 9 09:34:12 EDT 2003


You may want to try making it cleaner, like this:

SELECT "column_name" 
FROM "table_name" 
WHERE "column_name" IN ('value1', 'value2', ...) 

http://www.1keydata.com/sql/sqlin.html

As far as speed go, I would not worry too much with modern DBMS.  If you do
get a lot of hits then you can try making a separate result table within the
DBMS that gets updated automatically, i.e., once a day.  At this point, all
your code has to do is just grab everyting from the result table without
making a lot of comparisons in the main table.

Pinyo

-----Original Message-----
From: Jeff [mailto:jsiegel1 at optonline.net]
Sent: Friday, May 09, 2003 9:21 AM
To: NYPHP Talk
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