select only where 2 things are true
| From: | rolf vreijdenberger | Date: | Wed, 11 Dec 2002 23:21:38 +0000 |
| Subject: | select only where 2 things are true | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24080@lists.php.net to get a copy of this message | ||
A
your_id
brand_id
B
brand_id
description
A is filled with this data
1-1, 1-2, 2-2, 3-1, 3-2
how to get the your_id's with description of the brand where there are more
brand_id's to a your_id
with the next query i can get the data out with a where clause, but I want
to select only the combo's
select A.your_id as id, B.description from A left join B on
A.brand_id=B.brand_id
what do i have to add, or do I have to use a subquery (fi so, i use mysql,
so I have to make temporary table)
so the output I want would be only 1 ( as it has two brand_id's, and 3 (
also 2 brand_id's))
thanks in advance