I have a table with employment records. It has Employee code, status, and date when table was updated. Like this:
| Employee | Status | Date |
|---|---|---|
| 001 | termed | 01/01/2020 |
| 001 | rehired | 02/02/2020 |
| 001 | termed | 03/03/2020 |
| 001 | rehired | 04/04/2021 |
Problem - I need to get period length when Employee was working for a company, and check if it was less than a year - then don't display that record.
There could be multiple hire-rehire cycles for each Employee. 10-20 is normal. So, I'm thinking about two separate selects into two tables, and then looking for a closest date from hire in table 1, to termination in table 2. But it seems like overcomplicated idea.
Is there a better way?