Group by 5 minute interval cakephp -


select     timestamp,      name,     count(b.name) time a, id  … group  unix_timestamp(timestamp) div 300, name 

enter image description here

i have above table , want count created_at column group 5 minutes interval of created_at , count create_at column 2016-09-01 16:21:29 2016-09-01 16:26:29

you have use floor() function unique integer every 5 minute

select timestamp, name, count(b.name) time a, id … group floor(unix_timestamp(timestamp)/300) 

Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -