Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/09/2011, 20:47
hendaviher
 
Fecha de Ingreso: septiembre-2011
Ubicación: Colombia
Mensajes: 17
Antigüedad: 12 años, 8 meses
Puntos: 2
Pregunta consulta compleja en Mysql con varias tablas

hola a todos, estoy en dimela con una consulta para la cual necesito la union de varias tablas en especial 3... le agradezco a la persona que me pueda colaborar le estaria muy agradecido la estructura de las tablas es esta:


CREATE TABLE `persona` (
`IdPersona` int(11) unsigned NOT NULL AUTO_INCREMENT,
`ApellidoP` varchar(25) NOT NULL DEFAULT '',
`ApellidoM` varchar(25) NOT NULL DEFAULT '',
`Nombre` varchar(50) NOT NULL DEFAULT '',
`Sexo` int(2) unsigned NOT NULL DEFAULT '0',
`Documento` varchar(20) NOT NULL DEFAULT '',
`NumeroDoc` varchar(15) DEFAULT '',
`FechaNacimiento` date DEFAULT NULL,
`DptoNacimiento` int(3) NOT NULL DEFAULT '0',
`McpioNacimiento` int(3) NOT NULL DEFAULT '0',
`FechaBautismo` date DEFAULT NULL,
`LibroBautismo` int(3) unsigned DEFAULT NULL,
`FolioBautismo` int(4) unsigned DEFAULT NULL,
`ActaBautismo` int(4) unsigned DEFAULT NULL,
`DptoBautismo` int(3) NOT NULL DEFAULT '0',
`McipioBautismo` int(3) NOT NULL DEFAULT '0',
`IdParroquiaBautismo` int(11) unsigned DEFAULT NULL,
`Domicilio` varchar(100) DEFAULT '',
`DptoDomicilio` int(3) NOT NULL DEFAULT '0',
`McpioDomicilio` int(3) NOT NULL DEFAULT '0',
`Telefono` int(7) unsigned DEFAULT '0',
`Celular` int(10) unsigned DEFAULT '0',
`EMail` varchar(100) DEFAULT '',
`Observaciones` text,
PRIMARY KEY (`IdPersona`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

CREATE TABLE `departamento` (
`IdDpto` int(3) unsigned NOT NULL AUTO_INCREMENT,
`Indicativo` int(1) unsigned DEFAULT '0',
`NombreDpto` varchar(80) NOT NULL DEFAULT '',
PRIMARY KEY (`IdDpto`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=latin1;

CREATE TABLE `municipio` (
`IdMcpio` int(4) unsigned NOT NULL AUTO_INCREMENT,
`IdDpto` int(3) unsigned NOT NULL DEFAULT '0',
`CodigoMcpio` int(5) unsigned NOT NULL DEFAULT '0',
`NombreMcpio` varchar(80) NOT NULL DEFAULT '',
PRIMARY KEY (`IdMcpio`)
) ENGINE=InnoDB AUTO_INCREMENT=1153 DEFAULT CHARSET=latin1;


la consulta que estoy tratando de sacar es que me muestre todos los campos de la persona y también el nombre del departamento y municipio de nacimiento, bautismo y domicilio de la persona, he intentado de varias formas pero no he logrado sacar la consulta...

Última edición por hendaviher; 06/09/2011 a las 20:49 Razón: faltaba informacion