Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/08/2014, 15:55
orteloco
 
Fecha de Ingreso: enero-2013
Ubicación: cusco
Mensajes: 13
Antigüedad: 12 años, 2 meses
Puntos: 0
Crear reporte de tablas

AYUDA COMO HACER REPORTE PRIMERO NECESITO METER ESTOS DATOS
TABLA 1 INTERVENCION CANTIDADA DE ENCUESTAS SACAMOS IDS
SELECT idintervencion FROM intervencion WHERE idPeriodo=2014 AND iddistrito=03 AND idprovincia=02 AND idRegion=08;
RESULTADO (30866,30865,30864,28101.......) 18 ENCUESTAS TOTALAS CON ESE ID
TABLA2 ACA ESTAN RESPUESTAS DE CASA ENCUESTA DE ARRIBA
SELECT * FROM evaluacionsaneamiento WHERE idSeccion="III" AND idSubSeccion="1" AND idintervencion
IN(SELECT idintervencion FROM intervencion WHERE idPeriodo=2014 AND iddistrito=03 AND idprovincia=02 AND idRegion=08) ORDER BY idintervencion;
TABLA3 item DONDE ESTA LAS PREGUNTAS EN NOMBRE ESTA UNIDA CON TABLA 2 POR EL IDITEM
SELECT * FROM item WHERE idSeccion="III" AND idSubSeccion="1" ORDER BY ORDEN;
TABLA4 item DONDE ESTA LAS RESPUESTAS EN NOMBRE ESTA UNIDA CON TABLA 2 POR EL VALOR SI TABLA2 UN ESTA 1 ACA SU ETIQUETA ES "SI"

SELECT *FROM alternativasaneamiento WHERE idSeccion="III" AND idSubSeccion="1"

LO QUE NECESITO ES UN SELECT
PREGUNTA | 30866 | 30865 | 30864 |28101
¿Está operativo? | NO | SI |NO | SI
EDAD |18 | NULL |18 |20
CIUDAD |MIAMI | LIMA | BUENOS A. |BILLBAOO


LO QUE HICE HASTA AHORA CON UN CURSOR CREAR UNA TABLA PARA CADA ENCUESTA PERO SON MAS 18 COMO UNIRLAS ?

ESTE ES EL SCRIP DE LA BD QUE ESTOY USANDO
[URL="https://onedrive.live.com/?cid=46D0F38DACC13C05&id=46D0F38DACC13C05!168"]AQUI ESTA ONEDRIVE[/URL]