Statistikk i Mikromarc 2 - Egendefinerte: Forskjell mellom sideversjoner
Fra Mikromarc Wiki
Hopp til navigeringHopp til søk
Ingen redigeringsforklaring |
Ingen redigeringsforklaring |
||
Linje 4: | Linje 4: | ||
<code><pre> | <code><pre> | ||
SELECT Title AS "Tittel", Author AS "Forfatter", Doctype AS "Materialbetegnelse", count(*) AS "Utlån" | SELECT Title AS "Tittel", Author AS "Forfatter", | ||
Doctype AS "Materialbetegnelse", count(*) AS "Utlån" | |||
FROM marchist | FROM marchist | ||
WHERE Service_Code in (8,9) | WHERE Service_Code in (8,9) | ||
Linje 26: | Linje 27: | ||
===Hyllevarmere - Titler uten utlån i perioden=== | ===Hyllevarmere - Titler uten utlån i perioden=== | ||
<code><pre> | <code><pre> | ||
SELECT pm_value11 as "Hylle", Pm_Value2 AS "Forfatter", Pm_Value1 AS "Tittel", Pm_Value4 AS Utgitt | SELECT pm_value11 as "Hylle", Pm_Value2 AS "Forfatter", | ||
Pm_Value1 AS "Tittel", Pm_Value4 AS Utgitt | |||
FROM Marc_Record | FROM Marc_Record | ||
WHERE Marc_Record.isscrapped = 0 | WHERE Marc_Record.isscrapped = 0 | ||
and Marc_Record.Marc_id NOT IN (SELECT Marc_id FROM Service_History WHERE Service_Time >= ':AddFilterFromDate' AND Service_Time <= ':AddFilterToDate' and service_code in (8,9)) | and Marc_Record.Marc_id NOT IN (SELECT Marc_id FROM | ||
Service_History WHERE Service_Time >= ':AddFilterFromDate' | |||
AND Service_Time <= ':AddFilterToDate' and service_code in (8,9)) | |||
:AddFilterUnit :AddFilter | :AddFilterUnit :AddFilter | ||
ORDER BY "Hylle", "Tittel", "Forfatter" , "Utgitt" | ORDER BY "Hylle", "Tittel", "Forfatter" , "Utgitt" | ||
Linje 37: | Linje 41: | ||
===Hyllevarmere - Eksemplar uten utlån i perioden=== | ===Hyllevarmere - Eksemplar uten utlån i perioden=== | ||
<code><pre> | <code><pre> | ||
SELECT (select pm_value1 from marc_record where marc_id = c.marc_id) AS Tittel | SELECT (select pm_value1 from marc_record | ||
-- Måtte jukse litt for at :AddFilter skulle slå inn på Marc_record og ikke service_history som er med i en select lenger ned men før første marc_record-select | where marc_id = c.marc_id) AS Tittel | ||
-- Måtte jukse litt for at :AddFilter skulle slå | |||
-- inn på Marc_record og ikke service_history som | |||
-- er med i en select lenger ned men før første marc_record-select | |||
, Pm_Value2 AS Forfatter, Pm_Value4 AS Utgitt, | , Pm_Value2 AS Forfatter, Pm_Value4 AS Utgitt, | ||
getshelfmark(C.ex_id) as Hylle, | getshelfmark(C.ex_id) as Hylle, | ||
C.bar_code AS Strekkode, | C.bar_code AS Strekkode, | ||
C.Reg_date as "Reg dato", | C.Reg_date as "Reg dato", | ||
(SELECT Description FROM Copy_status WHERE Code = C.Status_code) AS Status, | (SELECT Description FROM Copy_status WHERE Code = C.Status_code) | ||
(select date(max(service_time)) from service_history where service_code = 8 and service_history.ex_id = c.ex_id) as "Sist utlånt", | AS Status, | ||
(select count(1) from service_history where service_code in (8) and service_history.ex_id = c.ex_id) as "Antall utlån" | (select date(max(service_time)) from service_history | ||
where service_code = 8 and service_history.ex_id = c.ex_id) | |||
as "Sist utlånt", | |||
(select count(1) from service_history where service_code | |||
in (8) and service_history.ex_id = c.ex_id) as "Antall utlån" | |||
FROM Marc_Record KEY JOIN Copy C | FROM Marc_Record KEY JOIN Copy C | ||
WHERE Marc_record.IsScrapped = 0 | WHERE Marc_record.IsScrapped = 0 |
Sideversjonen fra 19. nov. 2008 kl. 01:01
Her finner du en del script som kan legges inn for å hente ut en statistikk for blant annet å markedsføre biblioteket.
Utlån (inkl. fornyelser) på topp - Titler (> 50 lån)
SELECT Title AS "Tittel", Author AS "Forfatter",
Doctype AS "Materialbetegnelse", count(*) AS "Utlån"
FROM marchist
WHERE Service_Code in (8,9)
:AddFilter
GROUP BY "Tittel", "Forfatter", "Materialbetegnelse"
HAVING "Utlån" > 50
ORDER BY "Utlån" DESC
Utlån (inkl. fornyelser) på topp - Forfatter (> 50 lån)
SELECT Author AS "Forfatter", count(*) AS "Utlån"
FROM marchist
WHERE Service_Code in (8,9)
:AddFilter
GROUP BY "Forfatter"
HAVING "Utlån" > 50
ORDER BY "Utlån" DESC
Hyllevarmere - Titler uten utlån i perioden
SELECT pm_value11 as "Hylle", Pm_Value2 AS "Forfatter",
Pm_Value1 AS "Tittel", Pm_Value4 AS Utgitt
FROM Marc_Record
WHERE Marc_Record.isscrapped = 0
and Marc_Record.Marc_id NOT IN (SELECT Marc_id FROM
Service_History WHERE Service_Time >= ':AddFilterFromDate'
AND Service_Time <= ':AddFilterToDate' and service_code in (8,9))
:AddFilterUnit :AddFilter
ORDER BY "Hylle", "Tittel", "Forfatter" , "Utgitt"
Hyllevarmere - Eksemplar uten utlån i perioden
SELECT (select pm_value1 from marc_record
where marc_id = c.marc_id) AS Tittel
-- Måtte jukse litt for at :AddFilter skulle slå
-- inn på Marc_record og ikke service_history som
-- er med i en select lenger ned men før første marc_record-select
, Pm_Value2 AS Forfatter, Pm_Value4 AS Utgitt,
getshelfmark(C.ex_id) as Hylle,
C.bar_code AS Strekkode,
C.Reg_date as "Reg dato",
(SELECT Description FROM Copy_status WHERE Code = C.Status_code)
AS Status,
(select date(max(service_time)) from service_history
where service_code = 8 and service_history.ex_id = c.ex_id)
as "Sist utlånt",
(select count(1) from service_history where service_code
in (8) and service_history.ex_id = c.ex_id) as "Antall utlån"
FROM Marc_Record KEY JOIN Copy C
WHERE Marc_record.IsScrapped = 0
AND Marc_record.Reg_Date < GetDate() - 365
AND C.Permit_Loan = 1
AND C.Is_scrapped = 0
AND C.status_code <> 2
AND NOT EXISTS (SELECT 1 FROM Service_History WHERE service_code = 8 and Service_Time > ':AddFilterFromDate' AND Service_Time <= ':AddFilterToDate' AND ex_id = c.ex_id)
:AddFilterUnit :AddFilter
Order by Hylle, Forfatter, Tittel, marc_record.marc_id, "Antall utlån"
Lånere - Antall nye lånere i perioden
SELECT
lg.grp_code as "Lånergruppe",
count(*) as Antall
FROM loaner key join loaner_group lg
WHERE reg_date >= ':AddFilterFromDate' and reg_date <= ':AddFilterToDate'
:AddFilter
group by "Lånergruppe"
order by "Lånergruppe"