i have three tables. products, class, and dept.
class and dept each have two fields - code and text.
products has a field named class (containing class codes) and a field named dept 
(containing dept codes)

for some depts, all the products that have that dept have the same class
for other depts, there are products in all classes with that dept.

i want to generate a list of depts based on product class/dept combinations. for 
example:
if there is a product with dept 1 and class 1, then dept 1 should be on the list
if there are no products in dept 2 with class 1, then dept 2 should not be on the list

i've tried

select dp.name, dp.dept
from dept.dept as dp
inner join products as pr on dp.dept=pr.dept where pr.class = '1';

i think this filters out the right depts, but of course it gives me multiple rows for 
each dept. how can i remove the duplicate
rows?

can anyone give me a clue? should i be organizing my tables differently if i want this 
kind of result?

thanks


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to