Find ALL information in the TransactionDetails database for a particular patron ID (NOT barcode). This will also show even if the patron was deleted. It is recommended you limit the number of days rather than attempting to show the entire history as it could be quite lengthy.
This will be affected by:
- What transactions you’ve enabled for logging
- If you remove patron IDs from historic transactions
There are other queries that can limit/refine patron account history output:
DECLARE @patronid INT;
DECLARE @days_of_history INT;
SET @patronid = <set_patron_id_here>; -- Replace <set_patron_id_here> with the desired patron ID
SET @days_of_history = <set_days_here>; -- Replace <set_days_here> with the desired number of days
SELECT
th.TranClientDate,
tt.TransactionTypeDescription,
w.DisplayName AS [Workstation],
pu.Name AS [StaffMember]
FROM
PolarisTransactions.Polaris.TransactionDetails td
JOIN
PolarisTransactions.Polaris.TransactionHeaders th ON td.TransactionID = th.TransactionID
JOIN
PolarisTransactions.Polaris.TransactionTypes tt ON th.TransactionTypeID = tt.TransactionTypeID
JOIN
Polaris.Polaris.workstations w ON th.WorkstationID = w.WorkstationID
JOIN
Polaris.Polaris.PolarisUsers pu ON th.PolarisUserID = pu.PolarisUserID
WHERE
td.TransactionSubTypeID = 6
AND td.numValue = @patronid
AND th.TranClientDate > DATEADD(day, @days_of_history * -1, GETDATE())
ORDER BY
th.TranClientDate DESC;