Skip to content
  • Leihfristdaten nach Materialart

    Wenn man das Leihfristdatum für einen bestimmten Materialtyp (z.B. "Lax") oder Standort (z.B. "FL:%") haben will, ist das gut mit Hilfe der ous_copy_cache-Tabelle und der dort aufgeführten Signaturen oder Materialart möglichen. So sähe der Abfrageteil dann mit einfachen Inner Joins aus (hier auch nochmal mit alternativen Group By und Order By bei Daten). Wie immer ohne Gewehr, weil ich keine Gewalt mag.

    Anmerkungen vorweg

    • Die ous_copy_cache (und acq_copy_cache) haben bis heute verwaiste Einträge (siehe Jira: https://jira.gbv.de/browse/LBSVIER-744). Also nicht wundern, wenn da viel viel mehr Lax, Luys etc stehen
    • Kleiner Tipp am Rande für die jetzt inspirierten: EPN/PNN sind in der DB ohne die Prüfziffer am Ende. Kopiert man diese also aus dem Katalog, LBS-Client oder sonstwo, dann für DB-Recherche letzte Ziffer entfernen. Umgekehrt, gibt man Leuten PPN-Listen aus der DB, dann am besten gleich ein * anfügen "PPN 123*"
    • Kleiner Tipp 2: Für ISBNs ist in äquivalenter Form auch acq_copy_cache nützlich

    Abfrage

    SELECT distinct
    	count(*) 'Anzahl',
    	convert(varchar(10), lr.expiry_date_loan,104) 'Ablaufdatum' -- Anmerkung * 104 = Deutsches Datum, 23 = ISO yyyy-mm-dd 
    FROM
    	loans_requests lr, volume v, ous_copy_cache occ
    WHERE 
    	lr.iln=23
    	and lr.iln=v.iln and lr.volume_number=v.volume_number --volume table für epn
    	and lr.iln=occ.iln and v.epn=occ.epn --copycache table für Signatur und oder type_of_material_copy
    	and lr.expiry_date_loan between convert(datetime, '2020-04-20 00:00:00') AND convert(datetime, '2020-07-30 00:00:00')
    	and occ.signature like 'FL:%' --Nach signature mit vorangestelltem Standort (z.B. TI:TIA-123 oder FL:%); eventuell besser als type_of_material, da bei "Lax" z.B. auch Schließfachschlüssel sind
    	--and type_of_material_copy in ('Luy', 'Lax')
    GROUP BY
    	convert(varchar(10), lr.expiry_date_loan,104)
    ORDER BY
    	convert(varchar(10), lr.expiry_date_loan,104) desc
    Edited by Tobias Zeumer
  • Leifristdaten nach bestimmter Nutzergruppe

    Abfrage

    SELECT distinct
    	count(*) 'Anzahl',
    	convert(varchar(10), lr.expiry_date_loan,104) 'Ablaufdatum' -- Anmerkung * 104 = Deutsches Datum, 23 = ISO yyyy-mm-dd 
    FROM
    	loans_requests lr, borrower b
    WHERE 
    	lr.iln=23
    	and lr.iln=b.iln and lr.address_id_nr=b.address_id_nr --borrower
    	and lr.expiry_date_loan between convert(datetime, '2020-05-10 00:00:00') AND convert(datetime, '2020-06-14 00:00:00')
    	and b.borrower_type in (50, 51) --Amthilfe und Fernleihe
    GROUP BY
    	convert(varchar(10), lr.expiry_date_loan,104)
    ORDER BY
    	convert(varchar(10), lr.expiry_date_loan,104) desc	
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment