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 LENOVO G450
CPU: Pentium(R) Dual-Core CPU T4400 @ 2.20GHz × 2
RAM: 4GB
Graphics: Intel GM45
OS: UBUNTU 18.04.4 LTS 64bits
GNOME 3.28.2
--
Best regards
Marco
Mexico City, Mexico

Options: ReplyQuote


Subject
Views
Written By
Posted
849
May 25, 2017 05:08AM
Re: Consulta entre dos tablas
2811
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.