From 106f44f591c0e44a1df4e0f68e17bfdd34490f55 Mon Sep 17 00:00:00 2001 From: Graham Hukill Date: Mon, 7 Oct 2024 09:29:30 -0400 Subject: [PATCH] Populate termination reason for employees Why these changes are being introduced: Termination reasons were missing for many employees. How this addresses that need: * Use table HR_APPT_ACTION_DETAIL instead of HR_APPT_TX_DETAIL, which has more tailored permissions for HRQBClient user. Side effects of this change: * Employees table has more termination reasons Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/HRQB-20 --- hrqb/tasks/sql/employees.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hrqb/tasks/sql/employees.sql b/hrqb/tasks/sql/employees.sql index a0790a7..43f394c 100644 --- a/hrqb/tasks/sql/employees.sql +++ b/hrqb/tasks/sql/employees.sql @@ -5,6 +5,8 @@ CHANGELOG - 2024-05-13 Query created and added - 2024-07-09 Added CTEs to gather last appointment transaction, to get termination or retirement reason + - 2024-10-07 Use table HR_APPT_ACTION_DETAIL vs HR_APPT_TX_DETAIL for termination + details */ with ordered_appt_txn as ( @@ -16,7 +18,7 @@ with ordered_appt_txn as ( partition by a.MIT_ID order by a.APPT_TX_BEGIN_DATE desc, a.APPT_TX_END_DATE desc ) as txn_row_num - from HR_APPT_TX_DETAIL a + from HR_APPT_ACTION_DETAIL a left join HR_PERSONNEL_ACTION_TYPE at on at.HR_PERSONNEL_ACTION_TYPE_KEY = a.HR_PERSONNEL_ACTION_TYPE_KEY where at.HR_PERSONNEL_ACTION in ('Termination','Retirement') ),