Re: How to find entries missing in 2nd table?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: How to find entries missing in 2nd table?
Date: 2006-07-11 15:52:01
Message-ID: 20060711155201.22418.qmail@web31810.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hi,
> I realize I probably lost my marbles but I've been having a god
> awful time with a single query:
>
> control:
> ....
> ....
> controller_id pk;
>
>
> datapack:
>
> controller_id fk;
> ....
> ....
> ....
>
> I need to get all entries from the table control that are not listed in
> datapack.

SELECT C.CONTROLLER_ID

FROM CONTROL AS C
LEFT JOIN DATAPACK AS D ON ( C.CONTROLLER_ID = D.CONTROLLER_ID)

WHERE D.CONTROLLER_ID IS NULL;

Regards,

Richard Broersma Jr.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2006-07-11 16:00:46 Re: How to find entries missing in 2nd table?
Previous Message Bryce Nesbitt 2006-07-11 15:44:33 Re: Can function results be used in WHERE?