Consulta a cuatro tablas, datos cuadruplicados
Publicado por Gabriel (4 intervenciones) el 21/03/2019 16:59:22
Hola a todos, tengo un problema al mostrar los resultados de mi consulta, yo realizo la consulta a las tablas y me muestra toda la info que necesito, pero me lo muestra 4 veces. dejo mi codigo, par ver si lguien puede ayudarme, nose si estoy haciendo algo mal...
****** AQUI DEJO LA ESTRUCTURAS DE LAS TABLAS ******
****** AQUI DEJO LA CONSULTA QUE REALIZO *****
$sql = "SELECT * FROM causa INNER JOIN rasgos INNER JOIN recorrido INNER JOIN imagenes";
$resultado = mysqli_query($ConDB, $sql);
****** AQUI DEJO LA ESTRUCTURAS DE LAS TABLAS ******
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
Estructura de tabla para la tabla `causa`
--
CREATE TABLE `causa` (
`id_causa` int(40) NOT NULL,
`caratula` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`expediente` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`lugar` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`fecha` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`autoridad` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `imagenes`
--
CREATE TABLE `imagenes` (
`id_fotos` int(40) NOT NULL,
`frente` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`perfil` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`cuerpo` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`anexo1` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`anexo2` varchar(255) COLLATE utf8_spanish_ci NOT NULL,
`anexo3` varchar(255) COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `rasgos`
--
CREATE TABLE `rasgos` (
`id_morfo` int(40) NOT NULL,
`altura` varchar(23) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`complexion` varchar(32) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`piel` varchar(23) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`obs` varchar(60) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`cabello` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`tatuajes` varchar(32) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `recorrido`
--
CREATE TABLE `recorrido` (
`id_recorrido` int(40) NOT NULL,
`ficha` int(15) NOT NULL,
`nombre` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`dni` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`domicilio` varchar(45) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`natalicio` date NOT NULL,
`lugarNac` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`provincia` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`apodo` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`sexo` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`estado` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`modalidad` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`ocupacion` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL,
`estudio` varchar(40) CHARACTER SET utf8 COLLATE utf8_spanish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `causa`
--
ALTER TABLE `causa`
ADD PRIMARY KEY (`id_causa`);
--
-- Indices de la tabla `imagenes`
--
ALTER TABLE `imagenes`
ADD PRIMARY KEY (`id_fotos`);
--
-- Indices de la tabla `rasgos`
--
ALTER TABLE `rasgos`
ADD PRIMARY KEY (`id_morfo`);
--
-- Indices de la tabla `recorrido`
--
ALTER TABLE `recorrido`
ADD PRIMARY KEY (`id_recorrido`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `causa`
--
ALTER TABLE `causa`
MODIFY `id_causa` int(40) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `imagenes`
--
ALTER TABLE `imagenes`
MODIFY `id_fotos` int(40) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `rasgos`
--
ALTER TABLE `rasgos`
MODIFY `id_morfo` int(40) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `recorrido`
--
ALTER TABLE `recorrido`
MODIFY `id_recorrido` int(40) NOT NULL AUTO_INCREMENT;
COMMIT;
****** AQUI DEJO LA CONSULTA QUE REALIZO *****
$sql = "SELECT * FROM causa INNER JOIN rasgos INNER JOIN recorrido INNER JOIN imagenes";
$resultado = mysqli_query($ConDB, $sql);
Valora esta pregunta
0