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

Поиск
Список
Период
Сортировка
От Exner, Peter
Тема Re: How to find entries missing in 2nd table?
Дата
Msg-id 507847EF2B23D748BAC77799DA52D0EC6FD63F@mailbox.his.de
обсуждение исходный текст
Ответ на How to find entries missing in 2nd table?  (alex-lists-pgsql@yuriev.com)
Ответы Re: How to find entries missing in 2nd table?
Re: How to find entries missing in 2nd table?
Список 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 по дате отправления:

Предыдущее
От: aurora
Дата:
Сообщение: Unexpected SQL error for UPDATE
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Unexpected SQL error for UPDATE