Re: SELECT query with multiple "WHERE" Clause
| From: | Daniel Brown | Date: | Wed, 27 Feb 2008 23:59:42 +0000 |
| Subject: | Re: SELECT query with multiple "WHERE" Clause | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44685@lists.php.net to get a copy of this message | ||
On Wed, Feb 27, 2008 at 6:44 PM, Nasreen Laghari
<nasreen_laghari@yahoo.com> wrote:
> I am creating a SEARCH, by only using one table. The search form is same as Inserting item
> (search has form of all fields in table ), difference is SEARCH page doesnt have validation .
> Therefore user can enter information in any of field. I would like to know how to write a SELECT
> query which has multiple where clause with OR operator.
SELECT * FROM tableName WHERE (colA LIKE '%value%' OR colB='1');
--- more ---
SELECT fieldA,fieldR,fieldT,fieldX FROM tableName WHERE
(colA='value' OR colB LIKE 'Hello%') AND colC='Active';
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>