From: | "Exner, Peter" <Exner(at)his(dot)de> |
---|---|
To: | "Richard Broersma Jr" <rabroersma(at)yahoo(dot)com>, "SQL Postgresql List" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: How to find entries missing in 2nd table? |
Date: | 2006-07-12 08:06:34 |
Message-ID: | 507847EF2B23D748BAC77799DA52D0EC6FD63F@mailbox.his.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)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(at)yahoo(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2006-07-12 12:18:30 | Re: Unexpected SQL error for UPDATE |
Previous Message | aurora | 2006-07-12 00:47:31 | Unexpected SQL error for UPDATE |