Ver Mensaje Individual
  #17  
Antiguo 03-11-2008
Avatar de rastafarey
rastafarey rastafarey is offline
Miembro
 
Registrado: nov 2003
Posts: 927
Reputación: 21
rastafarey Va por buen camino
Resp

Código SQL [-]
select first 1 fecha, hora, dato
from tablasensores
where fecha between fecha1 and fecha2 and sensor = 1
union
select first 1 fecha, hora, dato
from tablasensores
where fecha between fecha1 and fecha2 and sensor = 2
union
select first 1 fecha, hora, dato
from tablasensores
where fecha between fecha1 and fecha2 and sensor = 3

Pruba con algo asi. Y sando case o luego lansas la consulta sobre esta misma conculta o usando with.

No tomen esta consulta a ala ligera hay varias consultas. pero se esta usando first 1 Aqui hay muchos beneficios.
__________________
Todo se puede, que no exista la tecnología aun, es otra cosa.
Responder Con Cita