-
-
Save radiuscz/edc8557c7ffc22d6669984601f534616 to your computer and use it in GitHub Desktop.
Intranet Koha: TOP 15 nejaktivnějších čtenářů
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select count(*) as Pocet, ctenar as 'Čtenář', branches.branchname as 'Oddělení', itemtypes.description as 'Typ jednotky' | |
from ( | |
select issuedate, itemnumber, borrowernumber, concat(firstname, " ", surname) as ctenar, old_issues.branchcode | |
from old_issues | |
left join borrowers USING(borrowernumber) | |
UNION | |
select issuedate, itemnumber, borrowernumber, concat(firstname, " ", surname) as ctenar, issues.branchcode | |
from issues | |
left join borrowers USING(borrowernumber) | |
) as T | |
LEFT JOIN items USING(itemnumber) | |
LEFT JOIN branches ON T.branchcode = branches.branchcode | |
LEFT JOIN itemtypes ON itemtypes.itemtype = items.itype | |
where issuedate BETWEEN <<Od|date>> AND <<Do|date>> | |
AND T.branchcode=<<Oddělení|branches>> | |
AND itype=<<Typ jednotky|itemtypes>> | |
group by borrowernumber | |
order by Pocet desc | |
LIMIT 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment