Hi,
I'm struggling with this and cannot pull the correct record count. I'm pulling employee records from a table that lists all events in an employee's tenure with our company. Every 'event' will have an Effective_Date and a Term_Date and a Version number. For example: (Below) employee 2525 was hired (change_id # 1) as a summer student on 1998/05/04 (Version 1). She remained a summer student until that 'event' termed on 1998/11/01 and she became a PFT 1998/11/01 (Version 2). The next event in her tenure was a merit increase received 2000/01/01 (version 3, change_id 25), followed by another 2000/06/01 (version 4).
Empid Version Eff_Date Term_Date Change_Id Status
--------------------------------------------------------------
2525 1 1998/05/04 1998/11/01 1 A
2525 2 1998/11/01 2000/01/01 40 A
2525 3 2000/01/01 2000/06/01 25 A
2525 4 2000/06/01 4444/12/31 25 A
The 4444/12/31 is our way of indicating the last event has not termed and is her current situation.
My problem: Envision this scenario with 600 employees, each having many events, the highest version being their "current" situation. I want to be able to pull the count of employees ‘as of’ a certain date. I’m currently using start and end date parameters and searching on a start date > the Eff_Date and an end date < Term_Date.
{HRIS_EMPLOYEE_POSITION.EFF_DATE}>={?Start_Date} and
{HRIS_EMPLOYEE_POSITION.TERM_DATE} <= {?End_Date} and
{HRIS_EMPLOYEE_POSITION.STATUS} in ["A", "R"]
However, if I pull data for a whole quarter, this pulls all event versions which take place between the start and end date. How do I extract the highest version number between those 2 dates?
Lastly, the select only pulls employees who have ‘events’ between those 2 dates. Anyone without an event gets left out resulting in an incorrect count. What do I do?
Any suggestions appreciated.
Q
I'm struggling with this and cannot pull the correct record count. I'm pulling employee records from a table that lists all events in an employee's tenure with our company. Every 'event' will have an Effective_Date and a Term_Date and a Version number. For example: (Below) employee 2525 was hired (change_id # 1) as a summer student on 1998/05/04 (Version 1). She remained a summer student until that 'event' termed on 1998/11/01 and she became a PFT 1998/11/01 (Version 2). The next event in her tenure was a merit increase received 2000/01/01 (version 3, change_id 25), followed by another 2000/06/01 (version 4).
Empid Version Eff_Date Term_Date Change_Id Status
--------------------------------------------------------------
2525 1 1998/05/04 1998/11/01 1 A
2525 2 1998/11/01 2000/01/01 40 A
2525 3 2000/01/01 2000/06/01 25 A
2525 4 2000/06/01 4444/12/31 25 A
The 4444/12/31 is our way of indicating the last event has not termed and is her current situation.
My problem: Envision this scenario with 600 employees, each having many events, the highest version being their "current" situation. I want to be able to pull the count of employees ‘as of’ a certain date. I’m currently using start and end date parameters and searching on a start date > the Eff_Date and an end date < Term_Date.
{HRIS_EMPLOYEE_POSITION.EFF_DATE}>={?Start_Date} and
{HRIS_EMPLOYEE_POSITION.TERM_DATE} <= {?End_Date} and
{HRIS_EMPLOYEE_POSITION.STATUS} in ["A", "R"]
However, if I pull data for a whole quarter, this pulls all event versions which take place between the start and end date. How do I extract the highest version number between those 2 dates?
Lastly, the select only pulls employees who have ‘events’ between those 2 dates. Anyone without an event gets left out resulting in an incorrect count. What do I do?
Any suggestions appreciated.
Q