이렇게 해보세요. select from_unixtime(floor(unix_timestamp(time)/300)*300) mygroup, sum(count) from mytable group by mygroup;