Brice Stacey home

Patrons with Multiple Active Barcodes

We are working to auto-populate users into our ILLiad system with active patrons in our ILS. We will be using patron barcodes as usernames. Before beginning this process, it's important that each user only has one active barcode. Otherwise, those users would have multiple ILLiad accounts.

Here is the SQL used to retrieve those users:

select 
  b1.patron_barcode, b2.patron_barcode
from
  patron_barcode b1, 
  patron_barcode b2, 
  patron p
where
  b1.patron_id = p.patron_id and
  b2.patron_id = p.patron_id and
  b1.patron_barcode_id < b2.patron_barcode_id and
  b1.patron_barcode is not null and
  b2.patron_barcode is not null and
  b1.barcode_status = 1 and
  b2.barcode_status = 1 and
  p.expire_date >= current_date;