Skillnad mellan versioner av "Nyckeltal för samlingarna Bibliotek Mellansjö"
Hoppa till navigering
Hoppa till sök
Klas (diskussion | bidrag) (Skapade sidan med '<pre> SELECT CASE WHEN ds.ccode IS NULL THEN '--' ELSE ds.ccode END AS Avdelning, CASE WHEN authorised_values.lib IS NULL THEN '--' ELSE authorised_values.lib END AS Placer...') |
Klas (diskussion | bidrag) |
||
Rad 1: | Rad 1: | ||
+ | |||
+ | == Nyttjandegrad == | ||
+ | |||
+ | Nyttjandegrad=Lån per exemplar under det senaste året | ||
+ | |||
<pre> | <pre> | ||
SELECT | SELECT | ||
− | + | branchname AS Bibliotek, Avdelning, Placering, Utlan, | |
− | + | Exemplar AS 'Egna exemplar', | |
− | + | ROUND( | |
− | + | (Utlan/Exemplar) | |
− | + | ,1) | |
− | + | AS Nyttjandegrad | |
− | AS Avdelning, | + | |
− | + | FROM | |
− | + | (SELECT statistics.branch, statistics.ccode AS Avdelning, authorised_values.lib AS Placering, COUNT(statistics.type) AS Utlan, | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ROUND( | ||
− | |||
− | |||
− | |||
− | FROM | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
(SELECT COUNT (*) | (SELECT COUNT (*) | ||
− | FROM items | + | FROM items |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | WHERE items.homebranch=statistics.branch | ||
+ | AND items.ccode=statistics.ccode | ||
+ | AND items.location=statistics.location) AS Exemplar | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
FROM statistics | FROM statistics | ||
− | LEFT JOIN | + | LEFT JOIN authorised_values ON (statistics.location=authorised_values.authorised_value) |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ) | ||
− | + | WHERE | |
− | + | statistics.branch LIKE <<Bibliotek|branches>> | |
− | + | AND statistics.ccode LIKE <<Avdelning|CCODE:all>> | |
− | + | AND statistics.location LIKE <<Placering|LOC:all>> | |
− | AND | + | AND statistics.itemtype LIKE <<Exemplartyp |itemtypes:all>> |
− | AND | + | AND statistics.type='issue' |
− | AND | ||
− | AND | ||
− | |||
− | + | GROUP BY branch,Avdelning,Placering | |
− | + | ORDER BY branch,ccode,location)t | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
+ | LEFT JOIN branches ON (t.branch=branches.branchcode) | ||
</pre> | </pre> |
Versionen från 8 mars 2023 kl. 15.44
Nyttjandegrad
Nyttjandegrad=Lån per exemplar under det senaste året
SELECT branchname AS Bibliotek, Avdelning, Placering, Utlan, Exemplar AS 'Egna exemplar', ROUND( (Utlan/Exemplar) ,1) AS Nyttjandegrad FROM (SELECT statistics.branch, statistics.ccode AS Avdelning, authorised_values.lib AS Placering, COUNT(statistics.type) AS Utlan, (SELECT COUNT (*) FROM items WHERE items.homebranch=statistics.branch AND items.ccode=statistics.ccode AND items.location=statistics.location) AS Exemplar FROM statistics LEFT JOIN authorised_values ON (statistics.location=authorised_values.authorised_value) WHERE statistics.branch LIKE <<Bibliotek|branches>> AND statistics.ccode LIKE <<Avdelning|CCODE:all>> AND statistics.location LIKE <<Placering|LOC:all>> AND statistics.itemtype LIKE <<Exemplartyp |itemtypes:all>> AND statistics.type='issue' GROUP BY branch,Avdelning,Placering ORDER BY branch,ccode,location)t LEFT JOIN branches ON (t.branch=branches.branchcode)