mysql - SQL hour averaging in 24hours -
hi i'm trying sql query based on hourly averaging in 24hours temperature sample table below. how can so? let me know if think high frequencies tables architecture face difficulties in future too. appreciate helps. thank you.
_id node_id modality timestamp value ------- ------- ----------- ------------ ------ 4930376 2002 temperature 24/8/15 6:25 30 4930377 2403 temperature 24/8/15 6:24 30 4930378 2004 temperature 24/8/15 6:21 30 4930379 2203 temperature 24/8/15 6:26 29 4930380 2211 temperature 24/8/15 6:21 29 4930381 2401 temperature 24/8/15 6:25 33 4930382 2411 temperature 24/8/15 6:24 30 4930383 2101 temperature 24/8/15 6:22 31 4930384 2201 temperature 24/8/15 6:27 30 4930385 2111 temperature 24/8/15 6:30 36 4930386 2113 temperature 24/8/15 6:27 35 4934082 3200 temperature 24/8/15 10:28 33 4934083 2402 temperature 24/8/15 10:30 32 4934084 2213 temperature 24/8/15 10:30 33 4934085 2103 temperature 24/8/15 10:34 36 4934086 2423 temperature 24/8/15 10:32 32 4934087 2421 temperature 24/8/15 10:34 32 4934088 2413 temperature 24/8/15 10:37 32 4934089 2102 temperature 24/8/15 10:31 35 4934090 2202 temperature 24/8/15 10:35 32 4934091 2404 temperature 24/8/15 10:33 35 4934092 2121 temperature 24/8/15 10:39 36 4934093 2002 temperature 24/8/15 10:35 33 4940370 2123 temperature 24/8/15 17:44 36 4940371 2422 temperature 24/8/15 17:40 33 4940372 2001 temperature 24/8/15 17:36 35 4940373 2301 temperature 24/8/15 17:39 32 4940374 2402 temperature 24/8/15 17:36 32 4940375 2103 temperature 24/8/15 17:40 36 4940376 2423 temperature 24/8/15 17:38 33 4940377 2421 temperature 24/8/15 17:40 33
select avg(value), _id, node_id, modality, value, timestamp yourtable group date(timestamp), hour(timestamp);
Comments
Post a Comment