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') ),