"Ed Lazor" <[EMAIL PROTECTED]> wrote on 04/07/2005 12:39:01 PM:

> Three tables like this:
> 
> --------------
> product_lines
> --------------
> id
> title
> 
> --------------
> manufacturer
> --------------
> id
> title
> 
> --------------
> manufacturer_product_line_index
> --------------
> id
> product_line_id
> manufacturer_id
> 
> 
> The index provides a one to many relationship - one product line can be
> associated with more than one company.
> 
> How do I get a list of product lines not in the index?
> 
> Thanks,
> 
> Ed
> 

To list all of the products without any entries in your "index" table:

SELECT p.id, p.title
FROM product_lines p
LEFT JOIN manufacturer_product_line_index i
        on i.product_line_id = p.id
WHERE i.id is null;

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to