From: | Anthony Sotolongo <asotolongo(at)gmail(dot)com> |
---|---|
To: | "Carolina Izaziga M(dot)" <izazigacarolina(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Consulta |
Date: | 2017-07-25 21:01:16 |
Message-ID: | 34c9ed6c-cd0d-2334-9bcd-dadf3f46082f@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Hola Carolina, si entendí bien, creo que puedes usar UNION para juntar
los resultados de las querys
SELECT * FROM TABLA1
Where nom='FERNANDO' and apell='CHAVEZ'
UNION
SELECT * FROM TABLA2
Where nom='CARLA' and apell='MERCADO';
Saludos
On 25/07/17 16:35, Carolina Izaziga M. wrote:
> Hola,soy nueva en postgres, tengo una consulta:
>
> Quisiera hacer búsquedas en 2 tablas con la misma estructura
>
>
> TABLA1
> item, nom, apell diagnostico
> 1 FERNANDO CHAVEZ HEB
> 2 FERNANDO FERNANDEZ NEU
> 3 CARLA MERCADO CAN
> TABLA2
> item, nom, apell, diagnostico
> 5 JUAN RIVERA BRON
> 6 CARLA MERCADO BRON
> 7 FIO SANTOS HEB
> Si hago una búsqueda en la tabla 1 de una personas hago lo siguiente
>
> SELECT * FROM TABLA1
>
> Where nom='FERNANDO' and apell='CHAVEZ';
>
>
>
> La query me devuelve
>
> item, nom, apell diagnostico
> 1 FERNANDO CHAVEZ HEB
>
> Pero si quiero hacer la misma búsqueda en ambas tablas a la vez,
> quiero buscar nom=CARLA y apell=MERCADO y que me devuelva el resultado
> de la búsqueda de la tabla 1 y 2.
>
>
> Muchas gracias
>
>
> --
> M. Carolina Izaziga Mercado
> /Gestión de Riesgos LA/FT /
From | Date | Subject | |
---|---|---|---|
Next Message | Gerardo Herzig | 2017-07-25 21:10:27 | Re: Consulta |
Previous Message | jvenegasperu . | 2017-07-25 20:49:38 | colorear codigo |