[Koha] [koha] COMBINE SQL REPORTS TO ONE WITH COLUMNS
Katrin Fischer
katrin.fischer.83 at web.de
Sat May 8 04:56:05 NZST 2021
Hi James,
that is not quite what you want yet, actually it's the other way around.
But maybe it will spark some ideas:
SELECT "Count of patrons" as "Type", count(*) as "Count" from borrowers
UNION
SELECT "Count of items", count(*) from items;
Will give you:
+------------------+-------+
| Type | Count |
+------------------+-------+
| Count of patrons | 54 |
| Count of items | 962 |
+------------------+-------+
You can combine several SQL queries using UNION, you just have to make
sure that the number of columns are always the same.
Hope this helps,
Katrin
On 07.05.21 07:41, muiru james wrote:
> Hello all,
>
> I have three different reports that give a count of books by DDC numbers.
> - Books on shelves
> - Books on loan
> - Damaged books
>
> I'm looking to combine the queries to give me one report with three columns
> as under:
> Books on shelves | Books on loan | Damaged Books
>
> Is there a way to do this?
>
> Warm regards
>
> James
> _______________________________________________
>
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
More information about the Koha
mailing list