finding items with 0 rels for a 0 to many relationship

From: danmcb <danielmcbrearty(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: finding items with 0 rels for a 0 to many relationship
Date: 2007-06-21 16:28:42
Message-ID: 1182443322.597220.15080@p77g2000hsh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I have two tables, say A and B, that have a many-to-many
relationship, implemented in the usual way with a join table A_B.

How can I economically find all the rows in table A whose id's are not
in A_B at all (i.e. they have zero instances of B associated)?

Thanks

Daniel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Masaru Sugawara 2007-06-21 16:29:00 Re: Subquery problems
Previous Message Tom Lane 2007-06-21 15:40:44 Re: 8.2.3 PANIC with "corrupted item pointer"