0

Let's say that my first column is time. What I want is to be able to count the rows grouping them by an arbitrary time range, for instance: by day, by hour, by 20 minutes intervals, by 15 seconds etc.

Ioana
  • 343
  • 5
  • 10
  • Here is the answer that already solved; http://stackoverflow.com/questions/5002661/how-to-group-time-by-hour-or-by-10-minutes – newuserua_ext Mar 09 '15 at 11:50

1 Answers1

0

Convert the timestamp into some appropriate number (here: number of seconds since the Unix epoch), then do an integer division by the number of seconds (which implicitly rounds down):

SELECT ...
GROUP BY strftime('%s', MyDate) / 15  -- or 20*60 etc.
CL.
  • 173,858
  • 17
  • 217
  • 259