Código:
como tendria que quedar mi SELECT para para mostrar datos propias de la tabla COMPUTADOR y las partes de mi tabla PARTE que tiene asociadas??/* Table: COMPUTADOR */ create table if not exists COMPUTADOR ( ID_COM int not null AUTO_INCREMENT, ID_SALA int not null, INGRESO_COM varchar(50), GARANTIA_COM varchar(20), primary key (ID_COM) ); /* Table: USA SE CREO SOLA X LA RELACION 1,N - 1,N */ create table if not exists USA ( ID_PAR int not null, ID_COM int not null, primary key (ID_PAR, ID_COM) ); /* Table: PARTE */ create table if not exists PARTE ( ID_PAR int not null AUTO_INCREMENT, ID_TPAR int not null, NOMBRE_PAR varchar(50), primary key (ID_PAR) );
cluster me dijo con subconsultas en SQL o con INNERT JOIN o con LEFT/RIGTH JOIN, pero no se como hacerla
esta es mi verion mysql: MySQL 4.1.9-max
los inserte asi:
Código:
INSERT INTO computador (id_com, id_sala, id_red, ingreso_com, garantia_com, usb_com) VALUES ('', '$sala', '$red', '$date', '$garantia', '$usb')"; //INGRESO A LA TABLA COMPUTADOR SUS DATOS PROPIOS query="INSERT INTO usa (id_com, id_par) VALUES ('$id_com', '$tmadre')"; //es como decir VALUES('1', '1') //ASI LE EMPIEZO A ASIGNAR LAS PARTES --> PARTE NRO 1 $query="INSERT INTO usa (id_com, id_par) VALUES ('$id_com', '$proce')"; //es como decir VALUES('1', '2') //ASI LE EMPIEZO A ASIGNAR LAS PARTES --> PARTE NRO 2, etc...