aca las tablas:
tabla egresado:
Código SQL:
Ver original
CREATE TABLE `egresado` ( `NUM_CED_EGR` INT(11) NOT NULL, `NOM_EGR` CHAR(25) DEFAULT NULL, `APE_EGR` CHAR(25) DEFAULT NULL, PRIMARY KEY (`NUM_CED_EGR`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
tabla programa:
Código SQL:
Ver original
CREATE TABLE `programa` ( `COD_PRO` INT(11) NOT NULL, `NOM_PRO` CHAR(50) DEFAULT NULL, PRIMARY KEY (`COD_PRO`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
tabla opciones_grado
Código SQL:
Ver original
CREATE TABLE `opciones_grado` ( `COD_OPC_GRA` INT(11) NOT NULL, `OPC_GRA` CHAR(30) DEFAULT NULL, PRIMARY KEY (`COD_OPC_GRA`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
tabla programas_egresado:
Código SQL:
Ver original
CREATE TABLE `programas_egresado` ( `NUM_CED_EGR` INT(11) NOT NULL, `COD_PRO` INT(11) NOT NULL, `FEC_ING` DATE DEFAULT NULL, `FEC_EGR` DATE DEFAULT NULL, `FEC_GRA` DATE DEFAULT NULL, `NUM_ACT_GRA` INT(11) DEFAULT NULL, PRIMARY KEY (`NUM_CED_EGR`,`COD_PRO`), KEY `FK_PROGRAMAS_EGRESADO2` (`COD_PRO`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
y tabla opciones_grado_egresado:
Código SQL:
Ver original
CREATE TABLE `opciones_grado_egresados` ( `NUM_CED_EGR` INT(11) NOT NULL, `COD_OPC_GRA` INT(11) NOT NULL, `DES_OPC_GRA` VARCHAR(100) DEFAULT NULL, `COD_PRO` INT(11) DEFAULT NULL, PRIMARY KEY (`NUM_CED_EGR`,`COD_OPC_GRA`), KEY `FK_OPCIONES_GRADO_EGRESADOS2` (`COD_OPC_GRA`), KEY `COD_PRO` (`COD_PRO`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Y lo que necesito es que en una sola consulta traer:
NOM_EGR - NOM_PRO - FEC_ING - FEC_EGR - FEC_GRA - OPC-GRA -DES_OPC_GRA
Y no he podido.
Hice el select de la siguiente forma pero me genera un erro de sintaxis
Código MySQL:
Ver original
e.NUM_CED_EGR, e.NOM_EGR, e.APE_EGR, p.NOM_PRO, og.OPC_GRA, pe.FEC_ING, pe.FEC_EGR, pe.FEC_GRA, oge.DES_OPC_GRA FROM egresado e, programa p, opciones_grado og, programas_egresado pe, opciones_grado egresados oge WHERE e.NUM_CED_EGR=oge.NUM_CED_EGR and og.COD_OPC_GRA=oge.COD_OPC_GRA and p.COD_PRO=pe.COD_PRO and p.COD_PRO=oge.COD_PRO
y el erro es el siguiente:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'oge WHERE e.NUM_CED_EGR = oge.NUM_CED_EGR and og.COD_OPC_GRA = oge.COD_OPC_GRA a' at line 1
Como podria entonces hacer esta consulta??
agradezco alguien me pueda colaborar
gracias