Skip to main content
ExLibris

Knowledge Assistant

BETA
 
  • Subscribe by RSS
  • Back
    Aleph

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Aleph
    3. Knowledge Articles
    4. Most recent loan date for items

    Most recent loan date for items

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    No headers
    • Article Type: General
    • Product: Aleph
    • Product Version: 19.01

    Description:
    For items that have been checked out multiple times, there is more than one z36h entry. If we have the following, how do we get the record with the most recent loan date only using SQL:

    Barcode Title Loans Loan Date
    39072021485275 Normal infant reflexes and development [videorecording] / the Hospital for Sick Children, Department 44 20070121 --> only want this on report
    39072021485275 Normal infant reflexes and development [videorecording] / the Hospital for Sick Children, Department 44 20061108
    39072021485275 Normal infant reflexes and development [videorecording] / the Hospital for Sick Children, Department 44 20060908

    Resolution:
    [From site:] We found that "group by" needed to be added. This worked:

    SQL> select z30_barcode, z13_title, z30_no_loans, max(z36h_loan_date)
    from buf01.z13, buf50.z30, buf50.z36h, buf50.z103
    where
    z30_sub_library = 'BUFHM' and
    z13_year <= 1990 and
    z36h_rec_key = z30_rec_key and
    (
    Z103_LKR_TYPE = 'ADM'
    and
    upper(substr(Z103_REC_KEY,1,5)) = 'BUF50'
    and
    upper(Z103_LKR_LIBRARY) = 'BUF01'
    and
    substr(Z103_REC_KEY,6,9) = substr(Z30_REC_KEY,1,9)
    and
    Z103_LKR_DOC_NUMBER = Z13_REC_KEY
    )
    group by z30_barcode, z13_title, z30_no_loans, z30_date_last_return
    order by z30_barcode;


    • Article last edited: 10/8/2013
    View article in the Exlibris Knowledge Center
    1. Back to top
      • More Tablespace Needed
      • Move a BIB Record with Linked Order to Another BIB Record
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Language
      English
      Product
      Aleph
    2. Tags
      1. 19.01
      2. contype:kba
      3. Prod:Aleph
      4. Type:General
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved