mysql query to select data per hour -


i trying build query data per hour particular day(or today). have device data table

#   name                      type           1  : idprimary  --       int(11)                     2 : inputdate   --      varchar(32)      3 : input1      --      varchar(11)          4 : input2      --      varchar(11)  

and in inputdate data in format :

select inputdate `devicedata` `inputdate` between '2015-05-29 16:30:07' , '2015-05-29 21:30:07' order id  

showing rows 0 - 24 (3304 total, query took 0.3487 seconds.)

2015-05-29 16:30:09  2015-05-29 16:30:20  2015-05-29 16:30:25  2015-05-29 16:30:41  2015-05-29 16:30:46  2015-05-29 16:30:51  2015-05-29 16:30:56  2015-05-29 16:31:01  2015-05-29 16:31:07  2015-05-29 16:31:49  2015-05-29 16:31:54  2015-05-29 16:32:00  2015-05-29 16:32:10  2015-05-29 16:32:15
want take 1 data in hour, minutes , seconds isn't important.for example :

2015-05-29 5:*:*  2015-05-29 6:*:*  2015-05-29 7:*:*  2015-05-29 8:*:* 

i don't know best way this. use regex can't this.

well, hideous, but. try query :)

select * (select substr(inputdate, 1, 13) hours, input1 devicedata order inputdate desc) t group hours; 

i might ve messed sorting direction, though/


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -