Ver Mensaje Individual
  #8  
Antiguo 16-10-2007
VRO VRO is offline
Miembro
 
Registrado: abr 2004
Posts: 230
Reputación: 21
VRO Va por buen camino
Wink Solucion final

Por si os hace falta el procedimiento es mas facil de lo que yo me pensaba, probe, por si sonaba la flauta y sonó.

La solución es la siguiente:

Código SQL [-]
 
DELIMITER $$
DROP PROCEDURE IF EXISTS `aytosantillana`.`prueba` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `prueba`(IN f1 char(20), IN f2 char(20))
BEGIN

  SELECT puertos.tag,puertos.dispositivo as disp,valores.fecha,case puertos.numpuerto when 0 then valores.A0 when 1 then valores.A1 when 2 then valores.A2 when 3 then valores.A3 when 3 then valores.A3 when 4 then valores.A4 when 5 then valores.A5 end as valor from equipos,puertos,valores where ((valores.idEquipo=puertos.idEquipo) and (equipos.idEquipo=puertos.idEquipo) and (equipos.idEquipo=valores.idEquipo) and (valores.fecha between  f1 and f2 )and (puertos.dispositivo<>'Contador') and (puertos.dispositivo<>'Alimentacion') and (puertos.dispositivo<>'Temperatura')  and (puertos.tag<>'')) having (valor<>'') order by puertos.dispositivo asc,valores.idEquipo asc,puertos.numpuerto asc, fecha asc;

END $$
DELIMITER ;

Gracias por vustra ayuda.
Responder Con Cita