MySQL Forums
Forum List  »  Spanish

CONSULTA DE DOS TABLAS
Posted by: pancho lopez
Date: November 25, 2010 02:12PM

Que tal amigos espero puedan ayudarme con un problema que tengo, me gustaria que me ayuden porfavor:

tengo dos tablas llamadas "personas" y "parejas" de la sieguiente forma

CREATE TABLE personas(id_persona INT NOT NULL PRIMARY KEY,nombres VARCHAR(50),apellidos VARCHAR(50))ENGINE=INNODB;

CREATE TABLE parejas(id_pareja INT NOT NULL PRIMARY KEY,color_ropa varchar(15),id_hombre int,id_mujer, FOREIGN KEY(id_hombre) REFERENCES personas(id_persona),FOREIGN KEY(id_mujer) REFERENCES personas(id_persona))ENGINE=INNODB;


lo que busco es una consulta que me muestre las claves y los nombres de las personas que forman una pareja, por ejemplo que muestre algo asi:


.....id_hombre.........nombre..........id_mujer.......nombre

.....1.................GEORGE.............1............MARY
.....2..................JHON..............2............JANE


he usado subconsultas pero me dice que el resultado arroja mas de una fila.
no se si esto que quiero hacer es posible, espero puedan ayudarme.de antemano gracias

Options: ReplyQuote


Subject
Views
Written By
Posted
CONSULTA DE DOS TABLAS
2508
November 25, 2010 02:12PM


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.