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

cron - how to properly run Python script with crontab on every system startup -

elasticsearch - Is the order of operations guaranteed in a bulk update? -

Slow performance first queries on SQL Azure -