Advertisement
chrissharp123

Untitled

Nov 29th, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. SELECT aged_circulation.id,
  2. aged_circulation.usr_post_code,
  3. aged_circulation.usr_home_ou,
  4. aged_circulation.usr_profile,
  5. aged_circulation.usr_birth_year,
  6. aged_circulation.copy_call_number,
  7. aged_circulation.copy_location,
  8. aged_circulation.copy_owning_lib,
  9. aged_circulation.copy_circ_lib,
  10. aged_circulation.copy_bib_record,
  11. aged_circulation.xact_start,
  12. aged_circulation.xact_finish,
  13. aged_circulation.target_copy,
  14. aged_circulation.circ_lib,
  15. aged_circulation.circ_staff,
  16. aged_circulation.checkin_staff,
  17. aged_circulation.checkin_lib,
  18. aged_circulation.renewal_remaining,
  19. aged_circulation.grace_period,
  20. aged_circulation.due_date,
  21. aged_circulation.stop_fines_time,
  22. aged_circulation.checkin_time,
  23. aged_circulation.create_time,
  24. aged_circulation.duration,
  25. aged_circulation.fine_interval,
  26. aged_circulation.recurring_fine,
  27. aged_circulation.max_fine,
  28. aged_circulation.phone_renewal,
  29. aged_circulation.desk_renewal,
  30. aged_circulation.opac_renewal,
  31. aged_circulation.duration_rule,
  32. aged_circulation.recurring_fine_rule,
  33. aged_circulation.max_fine_rule,
  34. aged_circulation.stop_fines,
  35. aged_circulation.workstation,
  36. aged_circulation.checkin_workstation,
  37. aged_circulation.checkin_scan_time,
  38. aged_circulation.parent_circ,
  39. aged_circulation.auto_renewal,
  40. aged_circulation.auto_renewal_remaining,
  41. NULL::integer AS usr
  42. FROM action.aged_circulation
  43. UNION ALL
  44. SELECT DISTINCT circ.id,
  45. COALESCE(a.post_code, b.post_code) AS usr_post_code,
  46. p.home_ou AS usr_home_ou,
  47. p.profile AS usr_profile,
  48. date_part('year'::text, p.dob)::integer AS usr_birth_year,
  49. cp.call_number AS copy_call_number,
  50. circ.copy_location,
  51. cn.owning_lib AS copy_owning_lib,
  52. cp.circ_lib AS copy_circ_lib,
  53. cn.record AS copy_bib_record,
  54. circ.xact_start,
  55. circ.xact_finish,
  56. circ.target_copy,
  57. circ.circ_lib,
  58. circ.circ_staff,
  59. circ.checkin_staff,
  60. circ.checkin_lib,
  61. circ.renewal_remaining,
  62. circ.grace_period,
  63. circ.due_date,
  64. circ.stop_fines_time,
  65. circ.checkin_time,
  66. circ.create_time,
  67. circ.duration,
  68. circ.fine_interval,
  69. circ.recurring_fine,
  70. circ.max_fine,
  71. circ.phone_renewal,
  72. circ.desk_renewal,
  73. circ.opac_renewal,
  74. circ.duration_rule,
  75. circ.recurring_fine_rule,
  76. circ.max_fine_rule,
  77. circ.stop_fines,
  78. circ.workstation,
  79. circ.checkin_workstation,
  80. circ.checkin_scan_time,
  81. circ.parent_circ,
  82. circ.auto_renewal,
  83. circ.auto_renewal_remaining,
  84. circ.usr
  85. FROM action.circulation circ
  86. JOIN asset.copy cp ON circ.target_copy = cp.id
  87. JOIN asset.call_number cn ON cp.call_number = cn.id
  88. JOIN actor.usr p ON circ.usr = p.id
  89. LEFT JOIN actor.usr_address a ON p.mailing_address = a.id
  90. LEFT JOIN actor.usr_address b ON p.billing_address = b.id;
  91.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement