Re: lo que se queda fuera de un join

From: Emanuel Calvo <3manuek(at)gmail(dot)com>
To: Kernel <jucabapa(at)gmail(dot)com>
Cc: Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: lo que se queda fuera de un join
Date: 2017-08-10 18:47:21
Message-ID: CAJeAsn9tCFEeJx248U6xp-Scod1zPYbx67L3-KK7RJw1Q=7iHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

SELECT * FROM t1 LEFT OUTER JOIN t2 USING (num) WHERE t2.values is null;

El 10 de agosto de 2017, 14:50, Kernel <jucabapa(at)gmail(dot)com> escribió:

>
>
>
> Voy a intentar explicarme con un ejemplo, necesito sacar todas aquellas
> filas de t1, que no estan en t2.
> Podría hacerlo con un 't1.num not in (select ....', pero lo necesito para
> un caso bastante mas complejo.
>
>
>
>
>
> tabla t1
>
> num | name
> -----+------
> 1 | a
> 2 | b
> 3 | c
>
> tabla t2
>
> num | value
> -----+-------
> 1 | xxx
> 3 | yyy
> 5 | zzz
>
>
> SELECT * FROM t1 INNER JOIN t2 ON t1.num = t2.num;
> num | name | num | value
> -----+------+-----+-------
> 1 | a | 1 | xxx
> 3 | c | 3 | yyy
>
>
>
> Lo que quiero obtener :
>
> num | name | num | value
> -----+------+-----+-------
> 2 | b | |
>
>
> Creo recordar que una vez vi algo en el manual
>
> Gracias
>
>
>
> El 10/08/2017 a las 19:19, Emanuel Calvo escribió:
>
>> {LEFT|RIGHT} OUTER JOIN ?
>>
>> LInk https://www.postgresql.org/docs/9.6/static/tutorial-join.html
>>
>>
>> El 10 de agosto de 2017, 13:55, Kernel <jucabapa(at)gmail(dot)com <mailto:
>> jucabapa(at)gmail(dot)com>> escribió:
>>
>> Hola,
>>
>> me suena que hay una forma de obtener los registros que se han
>> quedado fuera de un join, estoy buscando en el manual pero no
>> consigo verlo,
>> ¿me podéis dar una pista para buscar el el manual?
>>
>> Gracias
>>
>>
>>
>>
>> --
>> --
>> Emanuel Calvo
>> Sr. Technical Services at Percona
>> Team Building at Ayres.io
>>
>
>

--
--
Emanuel Calvo
Sr. Technical Services at Percona
Team Building at Ayres.io

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Hellmuth Vargas 2017-08-10 19:33:31 comportamiento transaccional WITH
Previous Message Hugo Germigniani - ProfInd 2017-08-10 18:46:31 RE: lo que se queda fuera de un join