I'm not sure if you mean that, but try:

SELECT DISTINCT(contents_.company_id), companies.* FROM 
contents_, companies
WHERE (contents_.Products LIKE '%heating%'
OR contents_.Manufacturer LIKE '%heating%')
AND contents_.company_id = companies.id

Lars

> -----Ursprüngliche Nachricht-----
> Von: Doug Parker [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 2. Oktober 2003 20:31
> An: [EMAIL PROTECTED]
> Betreff: [PHP-DB] query problem
> 
> 
> I'm having a problem with a specific query.
> 
> SELECT DISTINCT(contents_.company_id), companies.* FROM 
> contents_, companies
> WHERE contents_.Products LIKE '%heating%'
> OR contents_.Manufacturer LIKE '%heating%'
> AND contents_.company_id = companies.id
> 
> 
> The query works fine without the "OR" segment, for example:
> 
> SELECT DISTINCT(contents_.company_id), companies.* FROM 
> contents_, companies
> WHERE contents_.Products LIKE '%heating%'
> AND contents_.company_id = companies.id
> 
> works fine.  But I need the query to search 2 columns, and 
> it's returnng a
> vast number of records when I do the first search.
> 
> Any help would be greatly appreciated.
> 
> ------------------------------------------------------------
> http://www.phreshdesign.com
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to