[Koha] Help with a report query
Katrin Fischer
katrin.fischer.83 at web.de
Tue Sep 24 16:50:23 NZST 2019
Hi Carlos,
what I usually do for years is a free text entry: <<year (YYYY)>> or
similar. So you could just switch out YEAR(NOW()) for that in your query
below.
We always try to use the statistics tables where possible as it's
usually faster than having to work with than a union of issues and
old_issues.
Hope this helps,
Katrin
On 24.09.19 02:51, Carlos Lopez wrote:
> Hi folks
>
> I have the following report query:
> ----
> SELECT monthname(datetime) month, type, count(datetime) as count
> from statistics
> where YEAR(datetime) = YEAR(NOW())
> and type in ('issue', 'renew')
> GROUP BY month, type
> ORDER BY month(datetime)
> ----
>
> This works well but I've been asked to provide a mechanism to select the year to run this for (I would guess similar to the construct " DATE (b.dateexpiry) BETWEEN <<Between (yyyy-mm-dd)|date>> AND <<and (yyyy-mm-dd)|date>>", except selecting only years)
>
> Is it possible to do this? And if so, how?
>
>
> With kind regards from the Dalton McCaughey Library Team
>
> Carlos Lopez
>
> Dalton McCaughey Library | 29 College Crescent, Parkville, VICTORIA 3052
> Ph: 03 9340 8888 ext.1 | library at dml.vic.edu.au | library.dmlibrary.org.au
>
> _______________________________________________
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
More information about the Koha
mailing list