MySQL Forums
Forum List  »  Spanish

Re: Consulta entre dos tablas
Posted by: Marco Rios
Date: May 25, 2017 06:03PM

Que tal Diego,
me parece que tu problema es bastante sencillo:
Se trata de hacer un JOIN con las 2 tablas, de la siguiente manera:

SELECT 
    t1.nombre
FROM 
    tabla1 t1 
    JOIN 
    tabla2 t2 ON t1.id = t2.id

aquí les estamos asignando a cada tabla un alias (t1 y t2, respectivamente) para facilitar el manejo y legibilidad.
al realizar el JOIN (interno), sólo aparecerán los registros comunes (esto es: la intersección de ambos conjuntos)

Thanks in advance for your valuable help.

Acer Aspire 2920
CPU: Intel Core 2 Duo T7300@2.00GHzX2
RAM: 4GB
Graphics: Intel 965GM
OS: UBUNTU 16.04 LTS 64bits
--
Best regards
Marco
Mexico City, Mexico

Options: ReplyQuote


Subject
Views
Written By
Posted
219
May 25, 2017 05:08AM
Re: Consulta entre dos tablas
82
May 25, 2017 06:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.