Skillnad mellan versioner av "Statistik"

Från Svenska kohanätverkets wiki
Hoppa till: navigering, sök
(Lade till författarfondens statistik)
(Alla rapporter för KBstatistiken lades till)
Rad 81: Rad 81:
 
   AND i.notforloan = 0  
 
   AND i.notforloan = 0  
 
GROUP BY i.biblionumber
 
GROUP BY i.biblionumber
 +
</pre>
 +
 +
'''KB-statistiken'''
 +
 +
Dessa rapporter togs ursprungligen fram av Magnus Enger på uppdrag av Hylte folkbibliotek. För att använda dem behöver du anpassa dem med avseende på sådant som t.ex. datum och de bibliotekskoder, koder för medietyp m.fl. som du använder.
 +
 +
19 Streckkoder referensexemplar
 +
Visar alla streckkoder för referensböcker. Antalet visas av Koha som anger antal matchande rader.
 +
<pre>
 +
SELECT barcode FROM items WHERE notforloan = 1
 +
</pre>
 +
 +
11-5 Antal referensexemplar
 +
<pre>
 +
SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE notforloan = 1 AND dateaccessioned NOT LIKE '2015-%' GROUP BY homebranch
 +
</pre>
 +
 +
18 Skönlitteratur - Bestånd för vuxna - lista
 +
<pre>SELECT itemcallnumber, count(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' -- Må ikke innehole mellomrom
 +
AND BINARY itemcallnumber LIKE '%H%' -- Må inneholde en stor H
 +
AND itemcallnumber != 'Hcg' -- Må ikke være Hcg
 +
AND itemcallnumber != 'Hcf' -- Må ikke være HCF
 +
AND BINARY itemcallnumber NOT LIKE 'u%' -- Må ikke starte på liten u
 +
AND BINARY itemcallnumber NOT LIKE 'uf%' -- Må ikke starte på liten uf
 +
AND BINARY itemcallnumber NOT LIKE 'ug%' -- Må ikke starte på liten ug
 +
GROUP BY itemcallnumber
 +
</pre>
 +
 +
18 Skönlitteratur - Bestånd för vuxna
 +
<pre>
 +
SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %'
 +
AND BINARY itemcallnumber LIKE '%H%'
 +
AND itemcallnumber != 'Hcg'
 +
AND itemcallnumber != 'Hcf'
 +
AND BINARY itemcallnumber NOT LIKE 'u%'
 +
AND BINARY itemcallnumber NOT LIKE 'uf%'
 +
AND BINARY itemcallnumber NOT LIKE 'ug%' AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch
 +
</pre>
 +
 +
18 Skönlitteratur - Bestånd för barn - lista
 +
<pre>
 +
SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) GROUP BY itemcallnumber
 +
</pre>
 +
 +
18 Skönlitteratur - Bestånd för barn
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch
 +
</pre>
 +
 +
18 Skönlitteratur - Nyförvärv för vuxna
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( itemcallnumber NOT LIKE '% %' AND BINARY itemcallnumber LIKE '%H%' AND itemcallnumber != 'Hcg' AND itemcallnumber != 'Hcf' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' ) GROUP BY home branch
 +
</pre>
 +
 +
18 Skönlitteratur - Nyförvärv för barn
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) ) GROUP BY home branch
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Bestånd för vuxna - lista
 +
<pre>
 +
SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' GROUP BY itemcallnumber
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Bestånd för vuxna
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Bestånd för barn - lista
 +
<pre>SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) GROUP BY itemcallnumber
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Bestånd för barn
 +
<pre>
 +
SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Nyförvärv för vuxna
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch
 +
</pre>
 +
 +
18 Fack- och referenslitteratur - Nyförvärv för barn
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch
 +
</pre>
 +
 +
20 nyförvärvade titler - poster (etter migrering)
 +
<pre>SELECT COUNT(*) AS Antal FROM biblio WHERE datecreated LIKE '2013-%' AND datecreated != '2013-09-07'
 +
</pre>
 +
 +
20 nyförvärvade titler - eksemplar (hele året)
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' GROUP BY homebranch
 +
</pre>
 +
 +
21 Bestånd av AV-medier per avdelning
 +
 +
Man må velge hvilken avdeling raporten skal gjelde for.
 +
<pre>
 +
SELECT itemtype, description, COUNT(*) AS Antal FROM itemtypes AS t, items AS i WHERE t.itemtype = i.itype AND itemtype != 'A' AND itemtype != 'FJ' AND itemtype != 'C' AND itemtype != 'DEP' AND itemtype != 'E' AND itemtype != 'N' AND itemtype != 'H' AND itemtype != 'TIDN' AND homebranch = <> GROUP BY itemtype
 +
</pre>
 +
 +
21 Nyförvärv av AV-medier
 +
 +
Man må velge hvilken avdeling raporten skal gjelde for.
 +
<pre>
 +
SELECT itemtype, description, COUNT(*) AS Antal FROM itemtypes AS t, items AS i WHERE t.itemtype = i.itype AND itemtype != 'A' AND itemtype != 'C' AND itemtype != 'DEP' AND itemtype != 'E' AND itemtype != 'N' AND itemtype != 'H' AND itemtype != 'TIDN' AND i.dateaccessioned like '2013-%' AND homebranch = <> GROUP BY itemtype
 +
</pre>
 +
 +
25 Beståndet av anpassade medier
 +
<pre>SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itype = 'TALBOK' AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch
 +
25 Utlåningen av anpassade medier SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics WHERE datetime LIKE '2013-%' AND itemtype = 'TALBOK' AND ( type = 'issue' OR type = 'renew' ) GROUP BY branch
 +
</pre>
 +
 +
27 Utlån - Skönlitteratur för vuxna
 +
<pre>SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND BINARY items.itemcallnumber LIKE '%H%' AND items.itemcallnumber != 'Hcg' AND items.itemcallnumber != 'Hcf' AND BINARY items.itemcallnumber NOT LIKE 'u%' AND BINARY items.itemcallnumber NOT LIKE 'uf%' AND BINARY items.itemcallnumber NOT LIKE 'ug%' GROUP BY branch
 +
</pre>
 +
 +
27 Utlån - Skönlitteratur för barn
 +
<pre>SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( type = 'issue' OR type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND ( BINARY items.itemcallnumber LIKE 'uH%' OR BINARY items.itemcallnumber LIKE 'ufH%' OR BINARY items.itemcallnumber LIKE 'ugH%' OR BINARY items.itemcallnumber LIKE 'Hcg%' OR BINARY items.itemcallnumber LIKE 'Hcf%' ) GROUP BY branch
 +
</pre>
 +
 +
27 Utlån - Fack- och referenslitteratur för vuxna
 +
<pre>SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND BINARY items.itemcallnumber NOT LIKE '%H%' AND BINARY items.itemcallnumber NOT LIKE 'u%' AND BINARY items.itemcallnumber NOT LIKE 'uf%' AND BINARY items.itemcallnumber NOT LIKE 'ug%' GROUP BY branch
 +
</pre>
 +
 +
27 Utlån - Fack- och referenslitteratur för barn
 +
<pre>SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND BINARY items.itemcallnumber NOT LIKE '%H%' AND ( BINARY items.itemcallnumber LIKE 'u%' OR BINARY items.itemcallnumber LIKE 'uf%' OR BINARY items.itemcallnumber LIKE 'ug%' ) GROUP BY branch
 +
</pre>
 +
 +
28 Utlåningen av AV-medier - aktive lån
 +
<pre>SELECT items.itype, COUNT(*) AS Laan, SUM(issues.renewals) AS Omlaan FROM issues LEFT JOIN items ON issues.itemnumber = items.itemnumber WHERE itype != 'A' AND itype != 'C' AND itype != 'DEP' AND itype != 'E' AND itype != 'N' AND itype != 'H' AND itype != 'TIDN' GROUP BY itype
 +
</pre>
 +
 +
28 Utlåningen av AV-medier - gamla lån
 +
<pre>SELECT items.itype, COUNT(*) AS Laan, SUM(old_issues.renewals) AS Omlaan FROM old_issues LEFT JOIN items ON old_issues.itemnumber = items.itemnumber WHERE itype != 'A' AND itype != 'C' AND itype != 'DEP' AND itype != 'E' AND itype != 'N' AND itype != 'H' AND itype != 'TIDN' GROUP BY itype
 +
</pre>
 +
 +
28 Utlån av AV-medier
 +
 +
Må velge hvilken avdeling rapporten gjelder for
 +
<pre>SELECT statistics.itemtype AS Typ, itemtypes.description AS Beskrivning, COUNT(*) AS Antal FROM statistics, itemtypes WHERE statistics.itemtype = itemtypes.itemtype AND statistics.itemtype != 'A' AND statistics.itemtype != 'C' AND statistics.itemtype != 'FJ' AND statistics.itemtype != 'DEP' AND statistics.itemtype != 'E' AND statistics.itemtype != 'N' AND statistics.itemtype != 'H' AND statistics.itemtype != 'TIDN' AND datetime like '2013-%' AND branch = <> GROUP BY statistics.itemtype
 +
</pre>
 +
 +
Utlåningen av talböcker 2014
 +
<pre>SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics WHERE datetime LIKE '2014-%' AND itemtype = 'TALBOK' AND ( type = 'issue' OR type = 'renew' ) GROUP BY branch
 +
</pre>
 +
 +
Ut- och omlån 2014.
 +
 +
Allt - fördelat på månader.
 +
<pre>SELECT branch AS Avdelning, LEFT(datetime, 7) as Maanad, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2014%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND branch = <> GROUP BY Maanad
 +
</pre>
 +
 +
Ut- och omlån 2015.
 +
 +
Allt - fördelat på månader.
 +
<pre>SELECT branch AS Avdelning, MONTH(datetime) as "Månad", COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2015%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) -- AND items.itemcallnumber NOT LIKE '% %' AND branch = <> GROUP BY Månad
 +
</pre>
 +
 +
19d - Totalt antal aktiva låntagare
 +
<pre>SELECT COUNT(DISTINCT borrowernumber) AS Antal_aktiva FROM statistics WHERE datetime LIKE '2016-%' AND branch != 'ORN'
 +
</pre>
 +
 +
19e - Aktiva låntagare som är under 18 år
 +
<pre>
 +
SELECT COUNT(DISTINCT s.borrowernumber) AS Antal_aktiva FROM statistics AS s, borrowers AS b WHERE s.borrowernumber = b.borrowernumber AND b.dateofbirth > DATE_SUB(CURDATE(), INTERVAL 18 YEAR) AND s.branch != 'ORN' AND s.datetime LIKE '2016%'
 +
</pre>
 +
 +
19c - Antal aktiva låntagare som är institutionslåntagare eller personer som saknar uppgift om personnummer
 +
<pre>SELECT COUNT(DISTINCT s.borrowernumber) AS Antal_aktiva FROM statistics AS s LEFT JOIN borrower_attributes AS ba ON s.borrowernumber = ba.borrowernumber WHERE s.datetime LIKE '2015%' AND s.branch != 'ORN' AND ba.attribute IS NULL
 +
</pre>
 +
 +
12a - Antal titlar på svenska språket
 +
<pre>
 +
SELECT SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) AS Språk, count(*) AS Antal FROM biblioitems GROUP BY Språk HAVING Språk = 'swe'
 +
</pre>
 +
 +
12b - Antal titlar på nationellt minoritetsspråk
 +
<pre>SELECT SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) AS Språk, count(*) AS Antal FROM biblioitems GROUP BY Språk HAVING ( Språk = 'fin' OR Språk = 'smi' OR Språk = '9mk' OR Språk = 'rom' OR Språk = 'yid' )
 +
</pre>
 +
 +
12c - Antal titlar på utländska språk
 +
<pre>SELECT COUNT(*) AS Antal FROM biblioitems WHERE SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'swe' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'fin' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'smi' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != '9mk' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'rom' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'yid'
 +
</pre>
 +
 +
19a - Antal aktiva låntagare som är kvinnor (Näst sista siffran i personnumret är jämn siffra)
 +
<pre>
 +
SELECT COUNT(DISTINCT s.borrowernumber) AS Antal FROM statistics AS s, borrower_attributes AS ba WHERE s.borrowernumber = ba.borrowernumber AND s.datetime LIKE '2016-%' AND s.branch != 'ORN' AND code = 'PRNSNR' AND LEFT( RIGHT(attribute, 2), 1) % 2 = 0
 +
</pre>
 +
 +
19b - Antal aktiva låntagare som är män (Näst sista siffran i personnumret är ojämn siffra)
 +
<pre>
 +
SELECT COUNT(DISTINCT s.borrowernumber) AS Antal FROM statistics AS s, borrower_attributes AS ba WHERE s.borrowernumber = ba.borrowernumber AND s.datetime LIKE '2016-%' AND s.branch != 'ORN' AND code = 'PRNSNR' AND LEFT( RIGHT(attribute, 2), 1) % 2 = 1
 +
</pre>
 +
 +
10A: Allting med itemtype: objekttyp böcker - Antal fack / skön / barn / vuxen
 +
<pre>SELECT COUNT(*) FROM items WHERE itype = 'BOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10A: Allting med itemtype: objekttyp böcker - Nyförvärv fack / skön / barn / vuxen <pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'BOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10B: Ljudböcker - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'LJUDBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10B: Ljudböcker - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'LJUDBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10C: Talböcker / Daisy - Antal objekt
 +
<pre>SELECT COUNT(*) FROM items WHERE itype = 'TALBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10C: Talböcker / Daisy - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'TALBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10D: itemtype Tidningar & Tidskrifter - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'TIDNINGAR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10D: itemtype Tidningar & Tidskrifter - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'TIDNINGAR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10F: Musik cd - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'MUSIK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10F: Musik cd - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'MUSIK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10H: mikrofilm mm - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'MIKROFILME' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10H: mikrofilm mm - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'MIKROFILME' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10I: Kartor mm - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'KARTOR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10I: Kartor mm - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'KARTOR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10J: Noter mm - Antal objekt
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'NOTER' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10J: Noter mm - Nyförvärv
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE itype = 'NOTER' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10G: Film - Antal objekt (allt med itemtype: Hyr-DVD och Musik-DVD)
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE ( itype = 'HYRDVD' OR itype = 'MUSIKFILM' ) AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
 +
</pre>
 +
 +
10G: Film - Nyförvärv (allt med itemtype: Hyr-DVD och Musik-DVD)
 +
<pre>
 +
SELECT COUNT(*) FROM items WHERE ( itype = 'HYRDVD' OR itype = 'MUSIKFILM' ) AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015
 +
</pre>
 +
 +
10 Objekttyper - Antal objekter
 +
 +
Alle bibliotek, unntatt Örnaskolan.
 +
<pre>
 +
SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2016 GROUP BY itype
 +
</pre>
 +
 +
10 Objekttyper - Nyförvärv
 +
 +
Alle bibliotek, unntatt Örnaskolan.
 +
<pre>
 +
SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) = 2016 GROUP BY itype
 +
<pre>
 +
 +
14 - Initiala lån
 +
 +
Alle bibliotek
 +
<pre>
 +
SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND s.type = 'issue' AND YEAR(s.datetime) = 2014 GROUP BY s.itemtype
 +
</pre>
 +
 +
14 - Omlån
 +
 +
Alle bibliotek
 +
<pre>
 +
SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND s.type = 'renew' AND YEAR(s.datetime) = 2014 GROUP BY s.itemtype
 +
</pre>
 +
 +
14 - Totala utlån
 +
 +
Alle bibliotek, unntatt Örnaskolan
 +
<pre>
 +
SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND ( s.type = 'issue' OR s.type = 'renew' ) AND YEAR(s.datetime) = 2015 GROUP BY s.itemtype
 +
</pre>
 +
 +
11-1 Bestånd av tryckta böcker och seriella publikationer för barn & unga
 +
 +
Alle bibliotek, unntatt Örnaskolan.
 +
<pre>
 +
SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2016 AND BINARY itemcallnumber LIKE 'u%' AND homebranch != 'ORN' GROUP BY itype
 +
</pre>
 +
 +
11-2 Antal nyförvärv av tryckta böcker och seriella publikationer för barn & unga
 +
 +
Alle bibliotek, unntatt Örnaskolan.
 +
<pre>
 +
SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) = 2016 AND BINARY itemcallnumber LIKE 'u%' AND homebranch != 'ORN' GROUP BY itype
 +
</pre>
 +
 +
11-3: Antal utlån av tryckta böcker och seriella publikationer för barn & unga
 +
 +
Alle bibliotek, unntatt Örnaskolan
 +
<pre>SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i, items WHERE s.itemtype = i.itemtype AND s.itemnumber = items.itemnumber AND ( s.type = 'issue' OR s.type = 'renew' ) AND s.branch != 'ORN' AND YEAR(s.datetime) = 2016 AND BINARY items.itemcallnumber LIKE 'u%' GROUP BY s.itemtype
 +
</pre>
 +
 +
11-4: Bestånd av skönlitteratur, tryckta böcker eller seriella publikationer
 +
<pre>
 +
SELECT itype AS itemtype, COUNT(*) AS Antal FROM items WHERE ( BINARY LEFT(itemcallnumber,4) LIKE '%H%' OR itemcallnumber LIKE '8%' ) AND YEAR(dateaccessioned) <= 2015 AND homebranch != 'ORN' GROUP BY itype
 +
</pre>
 +
 +
11-6: Bestånd av medier för personer med läsnedsättning
 +
 +
Alle bibliotek unntatt Örnaskolan
 +
<pre>SELECT itype AS itemtype, COUNT(*) AS Antal FROM items WHERE ( location = 'TALBOKVUXEN' OR location = 'TALBOKBARN' OR location = 'TALBOKTUNN' OR location = 'APPELHYLLAN' OR location = 'BOKDAISY' OR location = 'SPRAKKEDJAN' OR location = 'SPRAKVASKOR' OR location = 'LATTLAST' OR location = 'LLMP3' OR location = 'LLSVE' OR location = 'STORSTIL' ) AND YEAR(dateaccessioned) <= 2015 AND homebranch != 'ORN' GROUP BY itype
 +
</pre>
 +
 +
11-7: Utlån av medier för personer med läsnedsätting
 +
 +
Alle bibliotek unntatt Örnaskolan
 +
<pre>SELECT i.itype AS itemtype, COUNT(*) AS Antal FROM statistics AS s, items AS i WHERE s.itemnumber = i.itemnumber AND ( location = 'TALBOKVUXEN' OR location = 'TALBOKBARN' OR location = 'TALBOKTUNN' OR location = 'APPELHYLLAN' OR location = 'BOKDAISY' OR location = 'SPRAKKEDJAN' OR location = 'SPRAKVASKOR' OR location = 'LATTLAST' OR location = 'LLMP3' OR location = 'LLSVE' OR location = 'STORSTIL' ) AND s.branch != 'ORN' AND s.type = 'issue' GROUP BY itype
 
</pre>
 
</pre>

Versionen från 17 januari 2017 kl. 14.56

Statistik i Koha finns under menyvalet "Mer / Rapporter" och redan från början finns ett antal färdiga rapporter som kan köras genom att klicka på länkarna. Den som vill kan också skapa egen statistik med hjälp av ett grafiskt gränssnitt även om det kräver viss förståelse av hur informationen är strukturerad i databasen. För den som kan databasspråket SQL finns det mycket goda möjligheter att ta ut egen statistik via SQL-frågor.

Egna SQL-rapporter kan du göra publika och de visas då som JSON-data vilket gör dem mycket användbara för att t.ex. förse en egen widget i Opac med rådata. Motsvarande skall också att göra med widgets i personalgränssnittet utan att känslig data exponeras publikt. I normalfallet tittar du på rapporten direkt i Koha och kan därifrån också ladda ned datat till Excel m.fl. för vidare bearbetning.

SQL-rapporter som andra funnit användbara

Författarfonden

De här rapporterna togs ursprungligen fram av Magnus Enger för Hyltes räkning. Notera att de är avsedda som en utgångspunkt för dina egna rapporter - du kommer troligen behöva anpassa dem något.

Ref, antal exemplar och signum

SELECT 
  i.homebranch AS Bibliotek, 
  SUBSTRING_INDEX( b.author, ', ', 1 )  AS Frfnamn, 
  b.title AS Titel, 
  SUBSTRING_INDEX( b.author, ', ', -1 ) AS Frffnamn,
  volume AS Del, 
  editionstatement AS Upplaga, 
  publicationyear AS Utgar, 
  isbn AS Isbn, 
  itemcallnumber AS signum,
  COUNT(*) AS Antal 
FROM 
  items as i, 
  biblio as b, 
  biblioitems as bi 
WHERE i.biblionumber = b.biblionumber 
  AND i.biblionumber = bi.biblionumber 
  AND i.notforloan = 1 
GROUP BY i.biblionumber

Ref och antal exemplar

SELECT 
  i.homebranch AS Bibliotek, 
  SUBSTRING_INDEX( b.author, ', ', 1 )  AS Frfnamn, 
  b.title AS Titel, 
  SUBSTRING_INDEX( b.author, ', ', -1 ) AS Frffnamn,
  volume AS Del, 
  editionstatement AS Upplaga, 
  publicationyear AS Utgar, 
  isbn AS Isbn, 
  COUNT(*) AS Antal 
FROM 
  items as i, 
  biblio as b, 
  biblioitems as bi 
WHERE i.biblionumber = b.biblionumber 
  AND i.biblionumber = bi.biblionumber 
  AND i.notforloan = 1 
GROUP BY i.biblionumber

År 2014 – Ej referens, antal utlån

SELECT 
  s.branch AS Bibliotek, 
  SUBSTRING_INDEX( b.author, ', ', 1 )  AS Frfnamn, 
  b.title AS Titel, 
  SUBSTRING_INDEX( b.author, ', ', -1 ) AS Frffnamn,
  volume AS Del, 
  editionstatement AS Upplaga, 
  publicationyear AS Utgar, 
  isbn AS Isbn, 
  COUNT(*) AS Antal 
FROM 
  statistics as s, 
  items as i, 
  biblio as b, 
  biblioitems as bi 
WHERE s.itemnumber = i.itemnumber 
  AND i.biblionumber = b.biblionumber 
  AND i.biblionumber = bi.biblionumber 
  AND s.datetime like '2014-%' 
  AND s.type = 'issue' 
  AND ( i.itype = 'A' OR i.itype = 'DEP' OR i.itype = 'B' OR i.itype = 'C' OR i.itype = 'TIDN' ) 
  AND i.notforloan = 0 
GROUP BY i.biblionumber

KB-statistiken

Dessa rapporter togs ursprungligen fram av Magnus Enger på uppdrag av Hylte folkbibliotek. För att använda dem behöver du anpassa dem med avseende på sådant som t.ex. datum och de bibliotekskoder, koder för medietyp m.fl. som du använder.

19 Streckkoder referensexemplar Visar alla streckkoder för referensböcker. Antalet visas av Koha som anger antal matchande rader.

SELECT barcode FROM items WHERE notforloan = 1

11-5 Antal referensexemplar

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE notforloan = 1 AND dateaccessioned NOT LIKE '2015-%' GROUP BY homebranch

18 Skönlitteratur - Bestånd för vuxna - lista

SELECT itemcallnumber, count(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' -- Må ikke innehole mellomrom 
AND BINARY itemcallnumber LIKE '%H%' -- Må inneholde en stor H 
AND itemcallnumber != 'Hcg' -- Må ikke være Hcg 
AND itemcallnumber != 'Hcf' -- Må ikke være HCF 
AND BINARY itemcallnumber NOT LIKE 'u%' -- Må ikke starte på liten u 
AND BINARY itemcallnumber NOT LIKE 'uf%' -- Må ikke starte på liten uf 
AND BINARY itemcallnumber NOT LIKE 'ug%' -- Må ikke starte på liten ug 
GROUP BY itemcallnumber

18 Skönlitteratur - Bestånd för vuxna

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' 
AND BINARY itemcallnumber LIKE '%H%' 
AND itemcallnumber != 'Hcg' 
AND itemcallnumber != 'Hcf' 
AND BINARY itemcallnumber NOT LIKE 'u%' 
AND BINARY itemcallnumber NOT LIKE 'uf%' 
AND BINARY itemcallnumber NOT LIKE 'ug%' AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch

18 Skönlitteratur - Bestånd för barn - lista

		
SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) GROUP BY itemcallnumber

18 Skönlitteratur - Bestånd för barn

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch

18 Skönlitteratur - Nyförvärv för vuxna

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( itemcallnumber NOT LIKE '% %' AND BINARY itemcallnumber LIKE '%H%' AND itemcallnumber != 'Hcg' AND itemcallnumber != 'Hcf' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' ) GROUP BY home branch

18 Skönlitteratur - Nyförvärv för barn

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( itemcallnumber NOT LIKE '% %' AND ( BINARY itemcallnumber LIKE 'uH%' OR BINARY itemcallnumber LIKE 'ufH%' OR BINARY itemcallnumber LIKE 'ugH%' OR BINARY itemcallnumber LIKE 'Hcg%' OR BINARY itemcallnumber LIKE 'Hcf%' ) ) GROUP BY home branch

18 Fack- och referenslitteratur - Bestånd för vuxna - lista

SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' GROUP BY itemcallnumber

18 Fack- och referenslitteratur - Bestånd för vuxna

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch

18 Fack- och referenslitteratur - Bestånd för barn - lista

SELECT itemcallnumber, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) GROUP BY itemcallnumber

18 Fack- och referenslitteratur - Bestånd för barn

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY home branch

18 Fack- och referenslitteratur - Nyförvärv för vuxna

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( BINARY itemcallnumber NOT LIKE '%H%' AND BINARY itemcallnumber NOT LIKE 'u%' AND BINARY itemcallnumber NOT LIKE 'uf%' AND BINARY itemcallnumber NOT LIKE 'ug%' ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch

18 Fack- och referenslitteratur - Nyförvärv för barn

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' AND ( BINARY itemcallnumber NOT LIKE '%H%' AND ( BINARY itemcallnumber LIKE 'u%' OR BINARY itemcallnumber LIKE 'uf%' OR BINARY itemcallnumber LIKE 'ug%' ) ) AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch

20 nyförvärvade titler - poster (etter migrering)

SELECT COUNT(*) AS Antal FROM biblio WHERE datecreated LIKE '2013-%' AND datecreated != '2013-09-07'

20 nyförvärvade titler - eksemplar (hele året)

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE dateaccessioned LIKE '2013-%' GROUP BY homebranch

21 Bestånd av AV-medier per avdelning

Man må velge hvilken avdeling raporten skal gjelde for.

SELECT itemtype, description, COUNT(*) AS Antal FROM itemtypes AS t, items AS i WHERE t.itemtype = i.itype AND itemtype != 'A' AND itemtype != 'FJ' AND itemtype != 'C' AND itemtype != 'DEP' AND itemtype != 'E' AND itemtype != 'N' AND itemtype != 'H' AND itemtype != 'TIDN' AND homebranch = <> GROUP BY itemtype

21 Nyförvärv av AV-medier

Man må velge hvilken avdeling raporten skal gjelde for.

SELECT itemtype, description, COUNT(*) AS Antal FROM itemtypes AS t, items AS i WHERE t.itemtype = i.itype AND itemtype != 'A' AND itemtype != 'C' AND itemtype != 'DEP' AND itemtype != 'E' AND itemtype != 'N' AND itemtype != 'H' AND itemtype != 'TIDN' AND i.dateaccessioned like '2013-%' AND homebranch = <> GROUP BY itemtype

25 Beståndet av anpassade medier

SELECT homebranch AS Avdelning, COUNT(*) AS Antal FROM items WHERE itype = 'TALBOK' AND dateaccessioned NOT LIKE '2014-%' GROUP BY homebranch
25 Utlåningen av anpassade medier		SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics WHERE datetime LIKE '2013-%' AND itemtype = 'TALBOK' AND ( type = 'issue' OR type = 'renew' ) GROUP BY branch

27 Utlån - Skönlitteratur för vuxna

SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND BINARY items.itemcallnumber LIKE '%H%' AND items.itemcallnumber != 'Hcg' AND items.itemcallnumber != 'Hcf' AND BINARY items.itemcallnumber NOT LIKE 'u%' AND BINARY items.itemcallnumber NOT LIKE 'uf%' AND BINARY items.itemcallnumber NOT LIKE 'ug%' GROUP BY branch

27 Utlån - Skönlitteratur för barn

SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( type = 'issue' OR type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND ( BINARY items.itemcallnumber LIKE 'uH%' OR BINARY items.itemcallnumber LIKE 'ufH%' OR BINARY items.itemcallnumber LIKE 'ugH%' OR BINARY items.itemcallnumber LIKE 'Hcg%' OR BINARY items.itemcallnumber LIKE 'Hcf%' ) GROUP BY branch

27 Utlån - Fack- och referenslitteratur för vuxna

SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND BINARY items.itemcallnumber NOT LIKE '%H%' AND BINARY items.itemcallnumber NOT LIKE 'u%' AND BINARY items.itemcallnumber NOT LIKE 'uf%' AND BINARY items.itemcallnumber NOT LIKE 'ug%' GROUP BY branch

27 Utlån - Fack- och referenslitteratur för barn

SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND statistics.datetime like '2013-%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND BINARY items.itemcallnumber NOT LIKE '%H%' AND ( BINARY items.itemcallnumber LIKE 'u%' OR BINARY items.itemcallnumber LIKE 'uf%' OR BINARY items.itemcallnumber LIKE 'ug%' ) GROUP BY branch

28 Utlåningen av AV-medier - aktive lån

SELECT items.itype, COUNT(*) AS Laan, SUM(issues.renewals) AS Omlaan FROM issues LEFT JOIN items ON issues.itemnumber = items.itemnumber WHERE itype != 'A' AND itype != 'C' AND itype != 'DEP' AND itype != 'E' AND itype != 'N' AND itype != 'H' AND itype != 'TIDN' GROUP BY itype

28 Utlåningen av AV-medier - gamla lån

SELECT items.itype, COUNT(*) AS Laan, SUM(old_issues.renewals) AS Omlaan FROM old_issues LEFT JOIN items ON old_issues.itemnumber = items.itemnumber WHERE itype != 'A' AND itype != 'C' AND itype != 'DEP' AND itype != 'E' AND itype != 'N' AND itype != 'H' AND itype != 'TIDN' GROUP BY itype

28 Utlån av AV-medier

Må velge hvilken avdeling rapporten gjelder for

SELECT statistics.itemtype AS Typ, itemtypes.description AS Beskrivning, COUNT(*) AS Antal FROM statistics, itemtypes WHERE statistics.itemtype = itemtypes.itemtype AND statistics.itemtype != 'A' AND statistics.itemtype != 'C' AND statistics.itemtype != 'FJ' AND statistics.itemtype != 'DEP' AND statistics.itemtype != 'E' AND statistics.itemtype != 'N' AND statistics.itemtype != 'H' AND statistics.itemtype != 'TIDN' AND datetime like '2013-%' AND branch = <> GROUP BY statistics.itemtype

Utlåningen av talböcker 2014

SELECT branch AS Avdelning, COUNT(*) AS Antal FROM statistics WHERE datetime LIKE '2014-%' AND itemtype = 'TALBOK' AND ( type = 'issue' OR type = 'renew' ) GROUP BY branch

Ut- och omlån 2014.

Allt - fördelat på månader.

SELECT branch AS Avdelning, LEFT(datetime, 7) as Maanad, COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2014%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) AND items.itemcallnumber NOT LIKE '% %' AND branch = <> GROUP BY Maanad

Ut- och omlån 2015.

Allt - fördelat på månader.

SELECT branch AS Avdelning, MONTH(datetime) as "Månad", COUNT(*) AS Antal FROM statistics, items WHERE statistics.itemnumber = items.itemnumber AND datetime like '2015%' AND ( statistics.type = 'issue' OR statistics.type = 'renew' ) -- AND items.itemcallnumber NOT LIKE '% %' AND branch = <> GROUP BY Månad

19d - Totalt antal aktiva låntagare

SELECT COUNT(DISTINCT borrowernumber) AS Antal_aktiva FROM statistics WHERE datetime LIKE '2016-%' AND branch != 'ORN'

19e - Aktiva låntagare som är under 18 år

SELECT COUNT(DISTINCT s.borrowernumber) AS Antal_aktiva FROM statistics AS s, borrowers AS b WHERE s.borrowernumber = b.borrowernumber AND b.dateofbirth > DATE_SUB(CURDATE(), INTERVAL 18 YEAR) AND s.branch != 'ORN' AND s.datetime LIKE '2016%'

19c - Antal aktiva låntagare som är institutionslåntagare eller personer som saknar uppgift om personnummer

SELECT COUNT(DISTINCT s.borrowernumber) AS Antal_aktiva FROM statistics AS s LEFT JOIN borrower_attributes AS ba ON s.borrowernumber = ba.borrowernumber WHERE s.datetime LIKE '2015%' AND s.branch != 'ORN' AND ba.attribute IS NULL

12a - Antal titlar på svenska språket

SELECT SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) AS Språk, count(*) AS Antal FROM biblioitems GROUP BY Språk HAVING Språk = 'swe'

12b - Antal titlar på nationellt minoritetsspråk

SELECT SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) AS Språk, count(*) AS Antal FROM biblioitems GROUP BY Språk HAVING ( Språk = 'fin' OR Språk = 'smi' OR Språk = '9mk' OR Språk = 'rom' OR Språk = 'yid' )

12c - Antal titlar på utländska språk

SELECT COUNT(*) AS Antal FROM biblioitems WHERE SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'swe' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'fin' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'smi' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != '9mk' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'rom' AND SUBSTRING(ExtractValue(marcxml, '//controlfield[@tag="008"]'), 36, 3) != 'yid'

19a - Antal aktiva låntagare som är kvinnor (Näst sista siffran i personnumret är jämn siffra)

SELECT COUNT(DISTINCT s.borrowernumber) AS Antal FROM statistics AS s, borrower_attributes AS ba WHERE s.borrowernumber = ba.borrowernumber AND s.datetime LIKE '2016-%' AND s.branch != 'ORN' AND code = 'PRNSNR' AND LEFT( RIGHT(attribute, 2), 1) % 2 = 0

19b - Antal aktiva låntagare som är män (Näst sista siffran i personnumret är ojämn siffra)

SELECT COUNT(DISTINCT s.borrowernumber) AS Antal FROM statistics AS s, borrower_attributes AS ba WHERE s.borrowernumber = ba.borrowernumber AND s.datetime LIKE '2016-%' AND s.branch != 'ORN' AND code = 'PRNSNR' AND LEFT( RIGHT(attribute, 2), 1) % 2 = 1

10A: Allting med itemtype: objekttyp böcker - Antal fack / skön / barn / vuxen

SELECT COUNT(*) FROM items WHERE itype = 'BOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015
10A: Allting med itemtype: objekttyp böcker - Nyförvärv fack / skön / barn / vuxen
SELECT COUNT(*) FROM items WHERE itype = 'BOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10B: Ljudböcker - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'LJUDBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10B: Ljudböcker - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'LJUDBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10C: Talböcker / Daisy - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'TALBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10C: Talböcker / Daisy - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'TALBOK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10D: itemtype Tidningar & Tidskrifter - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'TIDNINGAR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10D: itemtype Tidningar & Tidskrifter - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'TIDNINGAR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10F: Musik cd - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'MUSIK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10F: Musik cd - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'MUSIK' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10H: mikrofilm mm - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'MIKROFILME' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10H: mikrofilm mm - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'MIKROFILME' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10I: Kartor mm - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'KARTOR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10I: Kartor mm - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'KARTOR' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10J: Noter mm - Antal objekt

SELECT COUNT(*) FROM items WHERE itype = 'NOTER' AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10J: Noter mm - Nyförvärv

SELECT COUNT(*) FROM items WHERE itype = 'NOTER' AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10G: Film - Antal objekt (allt med itemtype: Hyr-DVD och Musik-DVD)

SELECT COUNT(*) FROM items WHERE ( itype = 'HYRDVD' OR itype = 'MUSIKFILM' ) AND homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2015

10G: Film - Nyförvärv (allt med itemtype: Hyr-DVD och Musik-DVD)

SELECT COUNT(*) FROM items WHERE ( itype = 'HYRDVD' OR itype = 'MUSIKFILM' ) AND homebranch != 'ORN' AND YEAR(dateaccessioned) = 2015

10 Objekttyper - Antal objekter

Alle bibliotek, unntatt Örnaskolan.

SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2016 GROUP BY itype

10 Objekttyper - Nyförvärv

Alle bibliotek, unntatt Örnaskolan.

SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) = 2016 GROUP BY itype
<pre>

14 - Initiala lån	

Alle bibliotek	
<pre>
SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND s.type = 'issue' AND YEAR(s.datetime) = 2014 GROUP BY s.itemtype

14 - Omlån

Alle bibliotek

SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND s.type = 'renew' AND YEAR(s.datetime) = 2014 GROUP BY s.itemtype

14 - Totala utlån

Alle bibliotek, unntatt Örnaskolan

SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i WHERE s.itemtype = i.itemtype AND ( s.type = 'issue' OR s.type = 'renew' ) AND YEAR(s.datetime) = 2015 GROUP BY s.itemtype

11-1 Bestånd av tryckta böcker och seriella publikationer för barn & unga

Alle bibliotek, unntatt Örnaskolan.

SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) <= 2016 AND BINARY itemcallnumber LIKE 'u%' AND homebranch != 'ORN' GROUP BY itype

11-2 Antal nyförvärv av tryckta böcker och seriella publikationer för barn & unga

Alle bibliotek, unntatt Örnaskolan.

SELECT itype, COUNT(*) AS Antal FROM items WHERE homebranch != 'ORN' AND YEAR(dateaccessioned) = 2016 AND BINARY itemcallnumber LIKE 'u%' AND homebranch != 'ORN' GROUP BY itype

11-3: Antal utlån av tryckta böcker och seriella publikationer för barn & unga

Alle bibliotek, unntatt Örnaskolan

SELECT s.itemtype, i.description, COUNT(*) AS Initiala FROM statistics AS s, itemtypes as i, items WHERE s.itemtype = i.itemtype AND s.itemnumber = items.itemnumber AND ( s.type = 'issue' OR s.type = 'renew' ) AND s.branch != 'ORN' AND YEAR(s.datetime) = 2016 AND BINARY items.itemcallnumber LIKE 'u%' GROUP BY s.itemtype

11-4: Bestånd av skönlitteratur, tryckta böcker eller seriella publikationer

SELECT itype AS itemtype, COUNT(*) AS Antal FROM items WHERE ( BINARY LEFT(itemcallnumber,4) LIKE '%H%' OR itemcallnumber LIKE '8%' ) AND YEAR(dateaccessioned) <= 2015 AND homebranch != 'ORN' GROUP BY itype

11-6: Bestånd av medier för personer med läsnedsättning

Alle bibliotek unntatt Örnaskolan

SELECT itype AS itemtype, COUNT(*) AS Antal FROM items WHERE ( location = 'TALBOKVUXEN' OR location = 'TALBOKBARN' OR location = 'TALBOKTUNN' OR location = 'APPELHYLLAN' OR location = 'BOKDAISY' OR location = 'SPRAKKEDJAN' OR location = 'SPRAKVASKOR' OR location = 'LATTLAST' OR location = 'LLMP3' OR location = 'LLSVE' OR location = 'STORSTIL' ) AND YEAR(dateaccessioned) <= 2015 AND homebranch != 'ORN' GROUP BY itype

11-7: Utlån av medier för personer med läsnedsätting

Alle bibliotek unntatt Örnaskolan

SELECT i.itype AS itemtype, COUNT(*) AS Antal FROM statistics AS s, items AS i WHERE s.itemnumber = i.itemnumber AND ( location = 'TALBOKVUXEN' OR location = 'TALBOKBARN' OR location = 'TALBOKTUNN' OR location = 'APPELHYLLAN' OR location = 'BOKDAISY' OR location = 'SPRAKKEDJAN' OR location = 'SPRAKVASKOR' OR location = 'LATTLAST' OR location = 'LLMP3' OR location = 'LLSVE' OR location = 'STORSTIL' ) AND s.branch != 'ORN' AND s.type = 'issue' GROUP BY itype