Re: mySQL Query - comparing multiple values with one field

From: Date: Wed, 22 Aug 2001 07:10:22 +0000
Subject: Re: mySQL Query - comparing multiple values with one field
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-63870@lists.php.net to get a copy of this message
On Wed, 22 Aug 2001 16:21, Niklas Lampén wrote: > What I need to do is to compare if one field matches a value from a > huge list of values. > > Do I need to query like > "SELECT * FROM table WHERE field LIKE '%value1%' || field LIKE > '%value2%'" or can I do it something like this > "SELECT * FROM table WHERE field LIKE ('%value1%' || > '%value2%')"? > > > Niklas Lampén The first will work. If you are doing exact comparisons, the mysql comparison operator IN may prove useful. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA It's as easy as 3.14159265358979323846264338327950...

« previous php.general (#63870) next »