[Koha] group by hour sql?

Chris Cormack chris at bigballofwax.co.nz
Tue Apr 13 10:58:16 NZST 2010


2010/4/13 Ian Trim <ian.trim at kapiticoast.govt.nz>:
> Hi all
> Looking to see busy times in the library. Can you GROUP BY hour? If so, how?
>
> Query so far:
> mysql> select count(*),datetime from statistics where type='return' and date(datetime)='2010-04-12' and branch='k' group by datetime;
>
Hi Ian

How's things up up the coast? This query should do what you want.

mysql> select count(*),hour(datetime) as hourly from statistics where
type='return' and date(datetime)='2010-04-12' and branch='k' group by
hourly;

Chris


More information about the Koha mailing list