Ver Mensaje Individual
  #1  
Antiguo 19-09-2014
luisangel_007 luisangel_007 is offline
Registrado
NULL
 
Registrado: sep 2014
Posts: 1
Reputación: 0
luisangel_007 Va por buen camino
Post como pivotar en Mysql??... AYUDA!!!

se neceita hacer un reporte como el siguiente cuadro

mi script solamente me debuelve el dato del primer día
expongo mi query de mysql :

Código SQL [-]
select deviceID, max(round(odometerKM))-min(round(odometerKM)) as dia1
from gts.EventData 
where  timestamp >= UNIX_TIMESTAMP('2014-08-10 00:00:00') and timestamp <= UNIX_TIMESTAMP('2014-08-10 23:59:00') 
group by deviceID;

el reporte debería tener un resultado como este:

Código:
REPORTE SEMANAL KILOMETRAJE RECORRIDO (KM) -diario

	           10-ago	11-ago	12-ago	13-ago	14-ago	15-ago	16-ago	17-ago
vehiculo1   	0	       0	0	        0	        0	          0	               0	7
vehiculo2   	0	       0	0	        0	        0	          0	               0	1
vehiculo3   	0	       0	0	        0	        0	          0	               0	0
vehiculo4   	4	       48	59	      48	       65	        178	              60	8
vehiculo5   	0	       0	0	       0	        0	          41	               0	14
vehiculo6   	0	       0	0	       0	        0	          0	               0	0
vehiculo7   	0	       0	0	       0	        0	          0	               0	0
vehiculo8   	 2	       1	27	       3	        3	         202	               8	14
vehiculo9   	  0	       0	0	       0	        0	           0	               0	 71
vehiculo10 	149	      189	79	      81	       48	           273	       81	48
vehiculo11 	167	      165	72	     106	       176	           230	      75	16
vehiculo12 	6             65	51	     125	        73	           94	             148	 0
vehiculo13 	63     	5	136	      111	        69	           106	      85	 0
alguna sugerencia??

Última edición por Casimiro Notevi fecha: 20-09-2014 a las 09:45:35.
Responder Con Cita