AW: query problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:drparker@phreshdesign.com] 
> Gesendet: Donnerstag, 2. Oktober 2003 20:31
> An: php-db@lists.php.net
> Betreff:  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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux