Mysql Slice a resultset

Slicing a mysql result is easy with

select from_unixtime(unix_timestamp(timestamp) -unix_timestamp(timestamp) % $slicecount) as slice, count(*) from event group
by slice

This will return the mysql statement sliced on the given number of slices.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.