Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    SQL for Loans by title in a specific time range

    • Article Type: General
    • Product: Aleph
    • Product Version: 18.01

    Description:
    I am trying to figure out a service of SQL query to get how many loans we had by serial title in the last year (from july 08 to july 09).

    Is there a way to get this data from ALEPH?

    Resolution:
    SQL> SELECT Z13_REC_KEY AS sys,
    Z13_AUTHOR AS author,
    Z13_TITLE AS title,
    Z13_IMPRINT AS imprint,
    COUNT(1) AS hits
    FROM IAD50.Z35,
    IAD50.Z103,
    IAD01.Z13
    WHERE Z35_EVENT_DATE BETWEEN 20080701 AND 20090731
    AND TRIM(Z35_EVENT_TYPE) IN ('50','51','52','53')
    AND TRIM(Z35_MATERIAL) = 'ISSUE'
    AND (Z13_REC_KEY = Z103_LKR_DOC_NUMBER)
    AND (Z103_LKR_TYPE = 'ADM')
    AND (Z103_LKR_LIBRARY = 'IAD01')
    AND (SUBSTR(Z103_REC_KEY,6,9) = Z35_REC_KEY)
    GROUP BY Z13_REC_KEY, Z13_AUTHOR, Z13_TITLE, Z13_IMPRINT
    ORDER BY hits DESC

    Additional Information

    sql


    • Article last edited: 10/8/2013