items/src/01.sql
authorMarijana Glavica <mglavica@ffzg.hr>
Tue, 20 Feb 2018 09:17:56 +0000 (10:17 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 28 Oct 2023 09:45:22 +0000 (11:45 +0200)
items/src/01.sql [new file with mode: 0644]

diff --git a/items/src/01.sql b/items/src/01.sql
new file mode 100644 (file)
index 0000000..859a644
--- /dev/null
@@ -0,0 +1,23 @@
+select 
+       concat( ifnull(copynumber,''), ifnull(stocknumber,'') ) as inventarni_broj,
+       i.biblionumber, 
+       i.itemnumber, 
+       itype as vrsta_gradje, 
+       a1.lib as lokacija,
+       i.itemcallnumber as signatura, 
+       a2.lib as nije_za_posudbu,
+       a3.lib as osteceno,
+       a4.lib as izgubljeno,
+       a5.lib as otpisano,
+       onloan as posudjeno_do 
+from items i 
+join biblioitems on i.biblionumber=biblioitems.biblionumber 
+join biblio on biblio.biblionumber=i.biblionumber 
+left join authorised_values a1 on a1.authorised_value = i.location and a1.category = 'LOC'
+left join authorised_values a2 on a2.authorised_value = i.notforloan and a2.category = 'NOT_LOAN'
+left join authorised_values a3 on a3.authorised_value = i.damaged and a3.category = 'DAMAGED'
+left join authorised_values a4 on a4.authorised_value = i.itemlost and a4.category = 'LOST'
+left join authorised_values a5 on a5.authorised_value = i.withdrawn and a5.category = 'WITHDROWN'
+where ccode='SRC' and location <> 'IZC' and itype <> 'PER' 
+order by a1.lib, itemcallnumber, itemlost, withdrawn, damaged 
+;