bibrarian

ILL Transaction Report

Aug 1st, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 2.70 KB | None | 0 0
  1. SELECT
  2.     th.TranClientDate AS [Transaction Date],
  3.     pu.Name AS [Polaris User],
  4.     illid.numValue AS [ILL Request ID],
  5.     tt.TransactionTypeDescription AS [Action],
  6.     title.TransactionString AS [Title],
  7.     p.Barcode AS [Patron Barcode],
  8.     pr.PatronFullName AS [Patron Name],
  9.     porg.DisplayName AS [Patron Branch],
  10.     borg.DisplayName AS [ILL Pickup Branch]
  11.  
  12. FROM
  13.     PolarisTransactions.Polaris.TransactionHeaders th WITH (NOLOCK)
  14.  
  15. INNER JOIN -- Pull the readable Transaction Type
  16.     PolarisTransactions.Polaris.TransactionTypes tt WITH (NOLOCK)
  17.     ON (tt.TransactionTypeID = th.TransactionTypeID)
  18. INNER JOIN -- Pull the ILL request ID
  19.     PolarisTransactions.Polaris.TransactionDetails illid WITH (NOLOCK)
  20.     ON (th.TransactionID = illid.TransactionID AND illid.TransactionSubTypeID = 177)
  21. INNER JOIN -- Pull the PatronID
  22.     PolarisTransactions.Polaris.TransactionDetails patron WITH (NOLOCK)
  23.     ON (th.TransactionID = patron.TransactionID AND patron.TransactionSubTypeID = 6)
  24. INNER JOIN -- Pull the Patron's OrganizationID
  25.     PolarisTransactions.Polaris.TransactionDetails patronorg WITH (NOLOCK)
  26.     ON (th.TransactionID = patronorg.TransactionID AND patronorg.TransactionSubTypeID = 13)
  27. INNER JOIN -- Pull the ILL destination branch
  28.     PolarisTransactions.Polaris.TransactionDetails illdest WITH (NOLOCK)
  29.     ON (th.TransactionID = illdest.TransactionID AND illdest.TransactionSubTypeID = 149)
  30. INNER JOIN -- Set up linkage from TransactionDetails to TransactionStrings to get ILL title
  31.     PolarisTransactions.Polaris.TransactionDetails titlelink WITH (NOLOCK)
  32.     ON (th.TransactionID = titlelink.TransactionID AND titlelink.TransactionSubTypeID = 49)
  33. INNER JOIN -- Pull the ILL's title
  34.     PolarisTransactions.Polaris.TransactionDetailStrings title WITH (NOLOCK)
  35.     ON (titlelink.numValue = title.TransactionStringID)
  36. INNER JOIN -- Use the PatronID in Patron Registration
  37.     Polaris.Polaris.PatronRegistration pr WITH (NOLOCK)
  38.     ON (pr.PatronID = patron.numValue)
  39. INNER JOIN -- Use the PatronID in Patrons
  40.     Polaris.Polaris.Patrons p WITH (NOLOCK)
  41.     ON (p.PatronID = patron.numValue)
  42. INNER JOIN -- Use the Patron's OrganizationID in Organizations
  43.     Polaris.Polaris.Organizations porg WITH (NOLOCK)
  44.     ON (porg.OrganizationID = patronorg.numValue)
  45. INNER JOIN -- Use the ILL destination OrganizationID in Organizations
  46.     Polaris.Polaris.Organizations borg WITH (NOLOCK)
  47.     ON (borg.OrganizationID = illdest.numValue)
  48. INNER JOIN -- Get the Polaris user who handled the ILL transaction
  49.     Polaris.Polaris.PolarisUsers pu WITH (NOLOCK) ON pu.PolarisUserID = th.PolarisUserID
  50.  
  51. WHERE
  52.     th.TransactionTypeID IN (6033,6035,6036)
  53. ORDER BY
  54.     th.TranClientDate,
  55.     illid.numValue
Add Comment
Please, Sign In to add comment