AW: [PHP-DB] query problem
| From: | Lars Jedinski | Date: | Thu, 02 Oct 2003 18:57:36 +0000 |
| Subject: | AW: [PHP-DB] query problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30809@lists.php.net to get a copy of this message | ||
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: [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
>