Skip to content

Instantly share code, notes, and snippets.

@mjlassila
Created October 8, 2019 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjlassila/8369a003f2641ed40dfc17a547f5392d to your computer and use it in GitHub Desktop.
Save mjlassila/8369a003f2641ed40dfc17a547f5392d to your computer and use it in GitHub Desktop.
Asiakkaalla varaus jo hänellä lainassa olevaan nimekkeeseen
SELECT
RTRIM(REGEXP_REPLACE(biblio.title,'[/,:]$','')) as 'Nimeke',
DATE(issues.issuedate) AS 'Lainattu',
reserves.reservedate AS 'Varattu',
CONCAT(
'<a target="_blank" href=\"/cgi-bin/koha/members/moremember.pl?borrowernumber=',
borrowers.borrowernumber,
'\">',
borrowers.cardnumber,
'</a>'
) AS Lainaaja,
items.itype AS 'Asiakkaalla lainassa oleva nidetyyppi'
FROM issues
INNER JOIN items USING(itemnumber)
INNER JOIN biblio USING(biblionumber)
INNER JOIN reserves ON items.biblionumber = reserves.biblionumber AND issues.borrowernumber = reserves.borrowernumber
INNER JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment