Re: How to find entries missing in 2nd table? - Mailing list pgsql-sql

From Exner, Peter
Subject Re: How to find entries missing in 2nd table?
Date
Msg-id 507847EF2B23D748BAC77799DA52D0EC6FD63F@mailbox.his.de
Whole thread Raw
In response to How to find entries missing in 2nd table?  (alex-lists-pgsql@yuriev.com)
Responses Re: How to find entries missing in 2nd table?
Re: How to find entries missing in 2nd table?
List pgsql-sql
Hi,

what about

SELECT controller_id FROM control
WHERE controller_id NOT IN
(SELECT DISTINCT controller_id FROM datapack);

?

Regards
Peter



> -----Ursprüngliche Nachricht-----
> Von: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org] Im Auftrag von
> Richard Broersma Jr
> Gesendet: Dienstag, 11. Juli 2006 19:04
> An: SQL Postgresql List
> Betreff: Re: [SQL] How to find entries missing in 2nd table?
>
>
>
> --- Richard Broersma Jr <rabroersma@yahoo.com> wrote:
>
> > > >> 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;
> > > >
> > >
> > >
> > > Or
> > > (SELECT controller_id FROM control)
> > > EXCEPT
> >
> > Good point!  But don't forget to include the list. :-)
> >
> > Regards,
> >
> > Richard Broersma Jr.
> > > (SELECT controller_id FROM datapack) ?
> > >
> > > --
> > > Milen A. Radev
> > >
> >
> >
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>


pgsql-sql by date:

Previous
From: aurora
Date:
Subject: Unexpected SQL error for UPDATE
Next
From: Michael Glaesemann
Date:
Subject: Re: Unexpected SQL error for UPDATE